Files
Microtransactions64/src/game/vc_ultra.c
Denis Kopyrin 4a3ef802d5 Fixed eeprom saving on VC (#334)
* Fixed eeprom saving on VC

* Specify SM for EEP4K, for any other savetype use ED

* Moved IS_VC() check to an earlier point, switch IS_VC()->gIsVC

* Moved binary VC files to bin folder, added checks for EEP

* Do not keep vc_bin if EEP is not set
2022-03-26 22:39:44 -04:00

69 lines
1.5 KiB
C

#include "vc_ultra.h"
#include "vc_bin.h"
#ifdef EEP
// These functions are real implementations of libultra functions
// with an exception that some VC useless code was dropped from them
// for the cleaner understanding purposes.
// These functions are generally wrappers around binary stubs from vc_bin
s32 osEepromProbeVC(OSMesgQueue *mq)
{
s32 ret;
u16 type;
ret = 0;
OSContStatus sdata;
ret = __osEepStatusVC(mq, &sdata); // call to binary stub
type = sdata.type & (CONT_EEPROM | CONT_EEP16K);
if (ret != 0)
{
ret = 0;
}
else
{
switch (type)
{
case CONT_EEPROM:
ret = EEPROM_TYPE_4K;
break;
case CONT_EEPROM | CONT_EEP16K:
ret = EEPROM_TYPE_16K;
break;
default:
ret = 0;
break;
}
}
return ret;
}
s32 osEepromLongReadVC(OSMesgQueue *mq, u8 address, u8 *buffer, int length)
{
s32 ret;
ret = 0;
while (length > 0)
{
osEepromReadVC(mq, address, buffer); // call to binary stub
length -= EEPROM_BLOCK_SIZE;
address++;
buffer += EEPROM_BLOCK_SIZE;
}
return ret;
}
s32 osEepromLongWriteVC(OSMesgQueue *mq, u8 address, u8 *buffer, int length)
{
s32 ret;
ret = 0;
while (length > 0)
{
osEepromWriteVC(mq, address, buffer); // call to binary stub
length -= EEPROM_BLOCK_SIZE;
address++;
buffer += EEPROM_BLOCK_SIZE;
}
return ret;
}
#endif