Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Req: BDEMU slot switcher #1080

Open
Fabax01 opened this issue May 30, 2024 · 2 comments
Open

Req: BDEMU slot switcher #1080

Fabax01 opened this issue May 30, 2024 · 2 comments

Comments

@Fabax01
Copy link

Fabax01 commented May 30, 2024

Hello,

Would it be possible to add a "switch BDEMU slot" command? Right now, I have to use Target Manager+DexGameMounter or BdemuPartitionTool - neither are available without a windows pc nearby.
I understand if it is too much of a hassle - I'm sure there aren't a lot of noncobra DEX users these days.

Best Regards

@aldostools
Copy link
Owner

aldostools commented May 31, 2024

Hello @Fabax01
I'm not using DEX and therefore I don't have a BDEMU disk to develop the feature and test it.

The feature should not be hard to create. It mainly requires to use open the USB device in raw mode using sys_storage_open, read the sector 0x100 (found at 0x20000), replace the byte at offset 0xF with the new value, write back the modified buffer to sector 0x100, close the device.
image

I suppose these are the commands needed:
#define SYS_STORAGE_OPEN 600
#define SYS_STORAGE_CLOSE 601
#define SYS_STORAGE_READ 602
#define SYS_STORAGE_WRITE 603

int sys_storage_open(u64 device_id, u64 unk, sys_device_handle_t *device_handle, u64 unk2);
int sys_storage_read(sys_device_handle_t device_handle, u64 mode, u64 start_sector, u32 sector_count, void *buf, u32 *nread, u64 flags);
int sys_storage_write(sys_device_handle_t device_handle, u64 mode, u64 start_sector, u32 sector_count, void *buf, u32 *nwrite, u64 flags); // ??
int sys_storage_close(sys_device_handle_t device_handle);

Maybe some developer using DEX could add the feature and make a pull request.

@aldostools
Copy link
Owner

BTW the feature could be extended to also patch the sizes of the slots like my BdemuPartitionTool does.

In the picture above are marked in red the offsets that need to be patched with the number of sectors per slot.

If I recall correctly, the "20" in offset 0x2000B is the count of slots that could be patched too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants