cc3dsfs/include/CaptureDeviceSpecific/Optimize_3DS/cypress_optimize_3ds_communications.hpp
Lorenzooone 4ce35770ac
Some checks are pending
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux32 flags:32 name:Linux GCC 32 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux64 flags:64 name:Linux GCC x64 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm32 flags:arm32 name:Linux GCC ARM 32 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm64 flags:arm64 name:Linux GCC ARM 64 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:macos name:macOS Apple Silicon os:macos-14]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win32 flags:-A Win32 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 Win32 os:windows-2022]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win64 flags:-A x64 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 x64 os:windows-2022]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:winarm64 flags:-A ARM64 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 ARM os:windows-2022]) (push) Waiting to run
CD / Create Pi Mono Setup (push) Blocked by required conditions
CD / Publishing (push) Blocked by required conditions
Implement Menu for adding Optimize serial keys
2025-11-09 04:11:37 +01:00

57 lines
2.7 KiB
C++

#ifndef __CYPRESS_OPTIMIZE_3DS_DEVICE_COMMUNICATIONS_HPP
#define __CYPRESS_OPTIMIZE_3DS_DEVICE_COMMUNICATIONS_HPP
#include <libusb.h>
#include <vector>
#include <fstream>
#include <thread>
#include "utils.hpp"
#include "capture_structs.hpp"
#include "cypress_shared_communications.hpp"
enum cypress_optimize_device_type {
CYPRESS_OPTIMIZE_NEW_3DS_BLANK_DEVICE,
CYPRESS_OPTIMIZE_NEW_3DS_INSTANTIATED_DEVICE,
CYPRESS_OPTIMIZE_OLD_3DS_BLANK_DEVICE,
CYPRESS_OPTIMIZE_OLD_3DS_INSTANTIATED_DEVICE,
};
struct cyop_device_usb_device {
std::string name;
std::string long_name;
cypress_optimize_device_type device_type;
uint8_t* firmware_to_load;
size_t firmware_size;
uint8_t* fpga_pl_565;
size_t fpga_pl_565_size;
uint8_t* fpga_pl_888;
size_t fpga_pl_888_size;
bool is_new_device;
cypress_optimize_device_type next_device;
bool has_bcd_device_serial;
PossibleCaptureDevices index_in_allowed_scan;
cy_device_usb_device usb_device_info;
};
int GetNumCyOpDeviceDesc(void);
const cyop_device_usb_device* GetCyOpDeviceDesc(int index);
const cyop_device_usb_device* GetNextDeviceDesc(const cyop_device_usb_device* device);
const cy_device_usb_device* get_cy_usb_info(const cyop_device_usb_device* usb_device_desc);
bool has_to_load_firmware(const cyop_device_usb_device* device);
bool load_firmware(cy_device_device_handlers* handlers, const cyop_device_usb_device* device, uint8_t patch_id);
bool read_firmware(cy_device_device_handlers* handlers, const cyop_device_usb_device* device, uint8_t* buffer_out, size_t read_size);
bool reset_cpu(cy_device_device_handlers* handlers, const cyop_device_usb_device* device);
int capture_start(cy_device_device_handlers* handlers, const cyop_device_usb_device* device, bool is_first_load, bool is_rgb888, uint64_t &device_id, std::string &read_key);
int StartCaptureDma(cy_device_device_handlers* handlers, const cyop_device_usb_device* device, bool is_rgb888, bool is_3d, std::string key);
int capture_end(cy_device_device_handlers* handlers, const cyop_device_usb_device* device);
int ReadFrame(cy_device_device_handlers* handlers, uint8_t* buf, int length, const cyop_device_usb_device* device_desc);
int ReadFrameAsync(cy_device_device_handlers* handlers, uint8_t* buf, int length, const cyop_device_usb_device* device_desc, cy_async_callback_data* cb_data);
uint64_t get_device_id_from_key(std::string key, bool is_new_device);
bool check_key_matches_device_id(uint64_t device_id, std::string key, bool is_new_device);
bool check_key_matches_device_id(uint64_t device_id, std::string key, const cyop_device_usb_device* device);
bool check_key_valid(std::string key, bool is_new_device);
bool check_key_valid(std::string key, const cyop_device_usb_device* device);
#endif