mirror of
https://github.com/Lorenzooone/cc3dsfs.git
synced 2025-06-19 09:05:31 -04:00

* Implement USB for Old DS and 3DS CCs * Update Readme and everything else to account for new devices * Handle no serial number * Reduce jitter on lower powered devices Thanks to https://github.com/nn9dev and loopy for older CCs testing There seem to be slowdowns on Windows when using the older CCs. Will need to figure that out.
39 lines
1.2 KiB
C++
Executable File
39 lines
1.2 KiB
C++
Executable File
#include "conversions.hpp"
|
|
#include "devicecapture.hpp"
|
|
#include "3dscapture_ftdi.hpp"
|
|
#include "usb_ds_3ds_capture.hpp"
|
|
|
|
#include <cstring>
|
|
|
|
void convertVideoToOutput(CaptureReceived *p_in, VideoOutputData *p_out, CaptureData* capture_data) {
|
|
#ifdef USE_FTDI
|
|
if(capture_data->status.device.is_ftdi)
|
|
ftdi_convertVideoToOutput(p_in, p_out, capture_data->status.enabled_3d);
|
|
#endif
|
|
#ifdef USE_USB
|
|
if(!capture_data->status.device.is_ftdi)
|
|
usb_convertVideoToOutput(p_in, p_out, &capture_data->status.device, capture_data->status.enabled_3d);
|
|
#endif
|
|
}
|
|
|
|
void convertAudioToOutput(CaptureReceived *p_in, sf::Int16 *p_out, uint64_t n_samples, const bool is_big_endian, CaptureData* capture_data) {
|
|
if(!capture_data->status.device.has_audio)
|
|
return;
|
|
uint8_t* base_ptr = NULL;
|
|
#ifdef USE_FTDI
|
|
if(capture_data->status.device.is_ftdi) {
|
|
if(!capture_data->status.enabled_3d)
|
|
base_ptr = (uint8_t*)p_in->ftdi_received.audio_data;
|
|
else
|
|
base_ptr = (uint8_t*)p_in->ftdi_received_3d.audio_data;
|
|
}
|
|
#endif
|
|
if(base_ptr == NULL)
|
|
return;
|
|
if(!is_big_endian)
|
|
memcpy(p_out, base_ptr, n_samples * 2);
|
|
else
|
|
for(int i = 0; i < n_samples; i += 2)
|
|
p_out[i] = (base_ptr[i + 1] << 8) | base_ptr[i];
|
|
}
|