webMAN-MOD icon indicating copy to clipboard operation
webMAN-MOD copied to clipboard

Req: BDEMU slot switcher

Open Fabax01 opened this issue 1 year ago • 2 comments

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

Fabax01 avatar May 30 '24 17:05 Fabax01

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 avatar May 31 '24 13:05 aldostools

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.

aldostools avatar May 31 '24 15:05 aldostools