mirror of
https://github.com/pret/pokestadium.git
synced 2026-08-28 05:44:22 -05:00
leoReadDiskId match
This commit is contained in:
@@ -1,3 +1,57 @@
|
||||
#include "common.h"
|
||||
#include <ultra64.h>
|
||||
#include "libleo/internal.h"
|
||||
|
||||
/*
|
||||
u8 leo_disk_id_lba[] = {14, 15}; //D_8007DAF0
|
||||
|
||||
LEOCmdRead read_id_cmd = { //D_80079590
|
||||
{LEO_COMMAND_READ, 0,0,0, 0,0,0,0, 0},
|
||||
14, 1, LEO_TempBuffer, 0
|
||||
};
|
||||
*/
|
||||
|
||||
extern u16 LEOrw_flags;
|
||||
extern u8 LEO_TempBuffer[0xE8];
|
||||
extern u8 leo_disk_id_lba[2];
|
||||
extern LEOCmdRead read_id_cmd;
|
||||
|
||||
void leoReadDiskId(void) {
|
||||
LEOCmdRead dummy_cmd;
|
||||
u8* temp_pointer;
|
||||
u32 cntr;
|
||||
|
||||
//Keep Disk ID Command and replace
|
||||
temp_pointer = (u8*)LEOcur_command;
|
||||
|
||||
//Read Disk ID to Temp Buffer
|
||||
LEOcur_command = (LEOCmd*)&dummy_cmd;
|
||||
for (cntr = 0; cntr < (sizeof(leo_disk_id_lba)); cntr++) {
|
||||
LEOrw_flags = 0x2000;
|
||||
dummy_cmd = read_id_cmd;
|
||||
dummy_cmd.lba = leo_disk_id_lba[cntr];
|
||||
leoRead_common(0);
|
||||
if (dummy_cmd.header.sense != LEO_SENSE_UNRECOVERED_READ_ERROR) break;
|
||||
}
|
||||
|
||||
//Put back the old ReadDiskID command
|
||||
LEOcur_command = (LEOCmd*)temp_pointer;
|
||||
|
||||
//Copy Disk ID to buffer pointed by ReadDiskID command
|
||||
temp_pointer = (u8*)LEOcur_command->data.readdiskid.buffer_pointer;
|
||||
for (cntr = 0; cntr < (sizeof(LEODiskID)); cntr += sizeof(u32))
|
||||
{
|
||||
*(u32 *)temp_pointer = *((u32 *)&LEO_TempBuffer[cntr]);
|
||||
temp_pointer += sizeof(u32);
|
||||
}
|
||||
|
||||
//Copy status and sense
|
||||
LEOcur_command->header.sense = dummy_cmd.header.sense;
|
||||
LEOcur_command->header.status = dummy_cmd.header.status;
|
||||
|
||||
if (LEOcur_command->header.status == LEO_STATUS_GOOD) {
|
||||
leoClrUA_MEDIUM_CHANGED();
|
||||
} else {
|
||||
leoSetUA_MEDIUM_CHANGED();
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/nonmatchings/libleo/leord_diskid/leoReadDiskId.s")
|
||||
|
||||
@@ -128,6 +128,9 @@ LEOVZONE_PZONEHD_TBL = 0x8007DC98;
|
||||
LEOBYTE_TBL1 = 0x8007DB78;
|
||||
LEOBYTE_TBL2 = 0x8007DB84;
|
||||
LEOZONE_OUTERCYL_TBL = 0x8007DD08;
|
||||
LEO_TempBuffer = 0x80100850;
|
||||
read_id_cmd = 0x80079590;
|
||||
leo_disk_id_lba = 0x8007DAF0;
|
||||
leo_sys_read_cmd = 0x80079560;
|
||||
leo_sys_form_lbas = 0x8007DA40;
|
||||
LEO_sys_data = 0x800FF9F0;
|
||||
|
||||
Reference in New Issue
Block a user