mirror of
https://github.com/Lorenzooone/cc3dsfs.git
synced 2026-09-07 16:15:18 -05:00
Add helper methods for 3d support
This commit is contained in:
@@ -211,7 +211,7 @@ struct CaptureStatus {
|
||||
volatile bool close_success = true;
|
||||
volatile int curr_delay = 0;
|
||||
volatile bool reset_hardware = false;
|
||||
bool enabled_3d = false;
|
||||
bool requested_3d = false;
|
||||
CaptureScreensType capture_type;
|
||||
CaptureSpeedsType capture_speed;
|
||||
int battery_percentage;
|
||||
|
||||
@@ -25,4 +25,7 @@ uint64_t get_audio_n_samples(CaptureData* capture_data, uint64_t read);
|
||||
uint64_t get_video_in_size(CaptureData* capture_data);
|
||||
std::string get_name_of_device(CaptureStatus* capture_status, bool use_long = false);
|
||||
int get_usb_speed_of_device(CaptureStatus* capture_status);
|
||||
bool get_device_can_do_3d(CaptureStatus* capture_status);
|
||||
bool get_device_3d_implemented(CaptureStatus* capture_status);
|
||||
bool get_3d_enabled(CaptureStatus* capture_status);
|
||||
#endif
|
||||
|
||||
@@ -46,13 +46,13 @@ void data_output_update(int inner_index, size_t read_data, CaptureData* capture_
|
||||
}
|
||||
|
||||
uint64_t ftd3_get_video_in_size(CaptureData* capture_data) {
|
||||
if(!capture_data->status.enabled_3d)
|
||||
if(!get_3d_enabled(&capture_data->status))
|
||||
return sizeof(RGB83DSVideoInputData);
|
||||
return sizeof(RGB83DSVideoInputData_3D);
|
||||
}
|
||||
|
||||
uint64_t ftd3_get_capture_size(CaptureData* capture_data) {
|
||||
if(!capture_data->status.enabled_3d)
|
||||
if(!get_3d_enabled(&capture_data->status))
|
||||
return sizeof(FTD3_3DSCaptureReceived) & (~(EXTRA_DATA_BUFFER_FTD3XX_SIZE - 1));
|
||||
return sizeof(FTD3_3DSCaptureReceived_3D) & (~(EXTRA_DATA_BUFFER_FTD3XX_SIZE - 1));
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ static usb_capture_status capture_read_oldds_3ds(CaptureData* capture_data, size
|
||||
CaptureReceived* data_buffer = &full_data_buf->capture_buf;
|
||||
libusb_device_handle* handle = (libusb_device_handle*)capture_data->handle;
|
||||
const usb_device* usb_device_desc = get_usb_device_desc(capture_data);
|
||||
const bool enabled_3d = capture_data->status.enabled_3d;
|
||||
const bool enabled_3d = get_3d_enabled(&capture_data->status);
|
||||
int bytesIn = 0;
|
||||
int transferred = 0;
|
||||
int result = 0;
|
||||
@@ -378,7 +378,7 @@ bool connect_usb(bool print_failed, CaptureData* capture_data, CaptureDevice* de
|
||||
}
|
||||
|
||||
uint64_t usb_get_video_in_size(CaptureData* capture_data) {
|
||||
return _usb_get_video_in_size(get_usb_device_desc(capture_data), capture_data->status.enabled_3d);
|
||||
return _usb_get_video_in_size(get_usb_device_desc(capture_data), get_3d_enabled(&capture_data->status));
|
||||
}
|
||||
|
||||
void usb_capture_main_loop(CaptureData* capture_data) {
|
||||
|
||||
@@ -179,6 +179,11 @@ static bool load(const std::string path, const std::string name, ScreenInfo &top
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key == "requested_3d") {
|
||||
capture_status->requested_3d = std::stoi(value);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(key == "last_connected_ds") {
|
||||
display_data.last_connected_ds = std::stoi(value);
|
||||
continue;
|
||||
@@ -226,7 +231,7 @@ static bool load(const std::string path, const std::string name, ScreenInfo &top
|
||||
}
|
||||
|
||||
static void defaults_reload(FrontendData *frontend_data, AudioData* audio_data, CaptureStatus* capture_status) {
|
||||
capture_status->enabled_3d = false;
|
||||
capture_status->requested_3d = false;
|
||||
capture_status->capture_type = CAPTURE_SCREENS_BOTH;
|
||||
capture_status->capture_speed = CAPTURE_SPEEDS_FULL;
|
||||
capture_status->battery_percentage = 100;
|
||||
@@ -308,6 +313,7 @@ static bool save(const std::string path, const std::string name, const std::stri
|
||||
file << save_screen_info("bot_", bottom_info);
|
||||
file << save_screen_info("joint_", joint_info);
|
||||
file << save_screen_info("top_", top_info);
|
||||
file << "requested_3d=" << capture_status->requested_3d << std::endl;
|
||||
file << "last_connected_ds=" << display_data.last_connected_ds << std::endl;
|
||||
file << "is_screen_capture_type=" << capture_status->capture_type << std::endl;
|
||||
file << "is_speed_capture=" << capture_status->capture_speed << std::endl;
|
||||
|
||||
@@ -276,7 +276,7 @@ bool convertVideoToOutput(VideoOutputData *p_out, const bool is_big_endian, Capt
|
||||
CaptureDevice* chosen_device = &status->device;
|
||||
#ifdef USE_FTD3
|
||||
if(chosen_device->cc_type == CAPTURE_CONN_FTD3) {
|
||||
ftd3_convertVideoToOutput(p_in, p_out, status->enabled_3d);
|
||||
ftd3_convertVideoToOutput(p_in, p_out, get_3d_enabled(status));
|
||||
converted = true;
|
||||
}
|
||||
#endif
|
||||
@@ -288,7 +288,7 @@ bool convertVideoToOutput(VideoOutputData *p_out, const bool is_big_endian, Capt
|
||||
#endif
|
||||
#ifdef USE_DS_3DS_USB
|
||||
if(chosen_device->cc_type == CAPTURE_CONN_USB) {
|
||||
usb_convertVideoToOutput(p_in, p_out, chosen_device, status->enabled_3d, is_big_endian);
|
||||
usb_convertVideoToOutput(p_in, p_out, chosen_device, get_3d_enabled(status), is_big_endian);
|
||||
converted = true;
|
||||
}
|
||||
#endif
|
||||
@@ -314,7 +314,7 @@ bool convertAudioToOutput(std::int16_t *p_out, uint64_t &n_samples, const bool i
|
||||
uint8_t* base_ptr = NULL;
|
||||
#ifdef USE_FTD3
|
||||
if(status->device.cc_type == CAPTURE_CONN_FTD3) {
|
||||
if(!status->enabled_3d)
|
||||
if(!get_3d_enabled(status))
|
||||
base_ptr = (uint8_t*)p_in->ftd3_received.audio_data;
|
||||
else
|
||||
base_ptr = (uint8_t*)p_in->ftd3_received_3d.audio_data;
|
||||
@@ -326,7 +326,7 @@ bool convertAudioToOutput(std::int16_t *p_out, uint64_t &n_samples, const bool i
|
||||
#endif
|
||||
#ifdef USE_DS_3DS_USB
|
||||
if(status->device.cc_type == CAPTURE_CONN_USB) {
|
||||
if(!status->enabled_3d)
|
||||
if(!get_3d_enabled(status))
|
||||
base_ptr = (uint8_t*)p_in->usb_received_3ds.audio_data;
|
||||
else
|
||||
base_ptr = (uint8_t*)p_in->usb_received_3ds_3d.audio_data;
|
||||
|
||||
@@ -267,6 +267,41 @@ int get_usb_speed_of_device(CaptureStatus* capture_status) {
|
||||
return capture_status->device.usb_speed >> 8;
|
||||
}
|
||||
|
||||
bool get_device_can_do_3d(CaptureStatus* capture_status) {
|
||||
if(!capture_status->connected)
|
||||
return false;
|
||||
if(!capture_status->device.is_3ds)
|
||||
return false;
|
||||
return capture_status->device.has_3d;
|
||||
}
|
||||
|
||||
bool get_device_3d_implemented(CaptureStatus* capture_status) {
|
||||
if(!capture_status->connected)
|
||||
return false;
|
||||
switch(capture_status->device.cc_type) {
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool get_3d_enabled(CaptureStatus* capture_status) {
|
||||
if(!capture_status->requested_3d)
|
||||
return false;
|
||||
if(!capture_status->connected)
|
||||
return false;
|
||||
if(!get_device_can_do_3d(capture_status))
|
||||
return false;
|
||||
if(!get_device_3d_implemented(capture_status))
|
||||
return false;
|
||||
switch(capture_status->device.cc_type) {
|
||||
default:
|
||||
if(get_usb_speed_of_device(capture_status) < 3)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void capture_init() {
|
||||
#ifdef USE_DS_3DS_USB
|
||||
usb_ds_3ds_init();
|
||||
|
||||
Reference in New Issue
Block a user