Fix issues with Old DS CC new code
Some checks failed
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[flags:-A ARM64 name:Windows VS2022 ARM os:windows-2022]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[flags:-A Win32 name:Windows VS2022 Win32 os:windows-2022]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[flags:-A x64 name:Windows VS2022 x64 os:windows-2022]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[flags:32 name:Linux GCC 32 os:ubuntu-latest]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[flags:64 name:Linux GCC x64 os:ubuntu-latest]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[flags:arm32 name:Linux GCC ARM 32 os:ubuntu-latest]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[flags:arm64 name:Linux GCC ARM 64 os:ubuntu-latest]) (push) Has been cancelled
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[name:macOS Apple Silicon os:macos-14]) (push) Has been cancelled
CD / Create Pi Mono Setup (push) Has been cancelled
CD / Publishing (push) Has been cancelled

This commit is contained in:
Lorenzooone
2024-11-02 23:41:51 +01:00
parent 4d9c645688
commit 2e475613b9
4 changed files with 17 additions and 17 deletions

View File

@@ -19,7 +19,7 @@
#define EXTRA_DATA_BUFFER_FTD3XX_SIZE (1 << 10)
enum CaptureConnectionType { CAPTURE_CONN_FTD3, CAPTURE_CONN_USB, CAPTURE_CONN_FTD2, CAPTURE_CONN_IS_NITRO };
enum InputVideoDataType { VIDEO_DATA_RGB, VIDEO_DATA_BGR, VIDEO_DATA_BGR16 };
enum InputVideoDataType { VIDEO_DATA_RGB, VIDEO_DATA_BGR, VIDEO_DATA_RGB16 };
enum CaptureScreensType { CAPTURE_SCREENS_BOTH, CAPTURE_SCREENS_TOP, CAPTURE_SCREENS_BOTTOM, CAPTURE_SCREENS_ENUM_END };
enum CaptureSpeedsType { CAPTURE_SPEEDS_FULL, CAPTURE_SPEEDS_HALF, CAPTURE_SPEEDS_THIRD, CAPTURE_SPEEDS_QUARTER, CAPTURE_SPEEDS_ENUM_END };
@@ -51,25 +51,25 @@ struct PACKED ISNitroEmulatorVideoInputData {
uint8_t screen_data[IN_VIDEO_SIZE_DS][3];
};
struct PACKED FTD3_3DSCaptureReceived {
struct ALIGNED(4) PACKED FTD3_3DSCaptureReceived {
RGB83DSVideoInputData video_in;
uint16_t audio_data[N3DSXL_SAMPLES_IN];
uint8_t unused_buffer[EXTRA_DATA_BUFFER_FTD3XX_SIZE];
};
struct PACKED FTD3_3DSCaptureReceived_3D {
struct ALIGNED(4) PACKED FTD3_3DSCaptureReceived_3D {
RGB83DSVideoInputData_3D video_in;
uint16_t audio_data[N3DSXL_SAMPLES_IN];
uint8_t unused_buffer[EXTRA_DATA_BUFFER_FTD3XX_SIZE];
};
struct PACKED USB3DSCaptureReceived {
struct ALIGNED(4) PACKED USB3DSCaptureReceived {
RGB83DSVideoInputData video_in;
uint16_t audio_data[O3DS_SAMPLES_IN];
uint8_t unused_buffer[EXTRA_DATA_BUFFER_USB_SIZE];
};
struct PACKED USB3DSCaptureReceived_3D {
struct ALIGNED(4) PACKED USB3DSCaptureReceived_3D {
RGB83DSVideoInputData_3D video_in;
uint16_t audio_data[O3DS_SAMPLES_IN];
uint8_t unused_buffer[EXTRA_DATA_BUFFER_USB_SIZE];
@@ -82,13 +82,13 @@ struct PACKED USBOldDSFrameInfo {
uint8_t unused[11];
};
struct PACKED USBOldDSCaptureReceived {
struct ALIGNED(4) PACKED USBOldDSCaptureReceived {
USBOldDSVideoInputData video_in;
uint8_t unused_buffer[EXTRA_DATA_BUFFER_USB_SIZE];
USBOldDSFrameInfo frameinfo;
};
struct PACKED ISNitroCaptureReceived {
struct ALIGNED(4) PACKED ISNitroCaptureReceived {
ISNitroEmulatorVideoInputData video_in;
};

View File

@@ -7,8 +7,10 @@
#if _MSC_VER && !__INTEL_COMPILER
#define PACKED
#define ALIGNED(x) alignas(x)
#else
#define PACKED __attribute__((packed))
#define ALIGNED(x) __attribute__((aligned(x)))
#endif
#define NAME "cc3dsfs"

View File

@@ -152,7 +152,7 @@ static int insert_device(std::vector<CaptureDevice> &devices_list, const usb_dev
if(usb_device_desc->is_3ds)
devices_list.emplace_back(serial_str, "3DS", CAPTURE_CONN_USB, (void*)usb_device_desc, true, capture_get_has_3d(handle, usb_device_desc), true, HEIGHT_3DS, TOP_WIDTH_3DS + BOT_WIDTH_3DS, O3DS_SAMPLES_IN, 90, 0, 0, TOP_WIDTH_3DS, 0, VIDEO_DATA_RGB);
else
devices_list.emplace_back(serial_str, "DS", CAPTURE_CONN_USB, (void*)usb_device_desc, false, false, false, WIDTH_DS, HEIGHT_DS + HEIGHT_DS, 0, 0, 0, 0, 0, HEIGHT_DS, VIDEO_DATA_BGR16);
devices_list.emplace_back(serial_str, "DS", CAPTURE_CONN_USB, (void*)usb_device_desc, false, false, false, WIDTH_DS, HEIGHT_DS + HEIGHT_DS, 0, 0, 0, 0, 0, HEIGHT_DS, VIDEO_DATA_RGB16);
libusb_close(handle);
return result;
}
@@ -268,12 +268,12 @@ static inline void usb_oldDSconvertVideoToOutputHalfLine(USBOldDSCaptureReceived
//de-interleave pixels
uint16_t* out_ptr_top = (uint16_t*)p_out->screen_data;
uint16_t* out_ptr_bottom = out_ptr_top + (WIDTH_DS * HEIGHT_DS);
uint16_t* in_ptr = (uint16_t*)&p_in;
uint16_t* in_ptr = (uint16_t*)p_in->video_in.screen_data;
for(int i = 0; i < WIDTH_DS / 2 ; i++) {
uint32_t input_halfline_pixel = (input_halfline * (WIDTH_DS / 2)) + i;
uint32_t output_halfline_pixel = (output_halfline * (WIDTH_DS / 2)) + i;
out_ptr_top[output_halfline_pixel] = in_ptr[input_halfline_pixel * 2];
out_ptr_bottom[output_halfline_pixel] = in_ptr[(input_halfline_pixel * 2) + 1];
out_ptr_bottom[output_halfline_pixel] = in_ptr[input_halfline_pixel * 2];
out_ptr_top[output_halfline_pixel] = in_ptr[(input_halfline_pixel * 2) + 1];
}
}

View File

@@ -437,8 +437,8 @@ std::string WindowScreen::title_factory() {
#define GL_BGR 0x80e0
#endif
#ifndef GL_UNSIGNED_SHORT_5_6_5_REV
#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
#ifndef GL_UNSIGNED_SHORT_5_6_5
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
#endif
void WindowScreen::update_texture() {
@@ -451,10 +451,8 @@ void WindowScreen::update_texture() {
GLenum type = GL_UNSIGNED_BYTE;
if(this->capture_status->device.video_data_type == VIDEO_DATA_BGR)
format = GL_BGR;
if(this->capture_status->device.video_data_type == VIDEO_DATA_BGR16) {
format = GL_RGB;
type = GL_UNSIGNED_SHORT_5_6_5_REV;
}
if(this->capture_status->device.video_data_type == VIDEO_DATA_RGB16)
type = GL_UNSIGNED_SHORT_5_6_5;
glTexSubImage2D(GL_TEXTURE_2D, 0, static_cast<GLint>(0), static_cast<GLint>(0), static_cast<GLsizei>(this->capture_status->device.width), static_cast<GLsizei>(this->capture_status->device.height), format, type, this->saved_buf);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);