src/core1: improvments and renamings on various files, added some header files
neue Datei: include/core1/eeprom.h neue Datei: include/core1/pfsmanager.h neue Datei: include/core1/ucode.h umbenannt: src/core1/code_18110.c -> src/core1/eeprom.c umbenannt: src/core1/code_10A00.c -> src/core1/pfsmanager.c umbenannt: src/core1/code_13640.c -> src/core1/stub_13640.c umbenannt: src/core1/code_1D590.c -> src/core1/stub_1D590.c umbenannt: src/core1/code_18210.c -> src/core1/ucode.c umbenannt: src/core1/code_EAF0.c -> src/core1/viewport.c
This commit is contained in:
31
src/core1/eeprom.c
Normal file
31
src/core1/eeprom.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <ultra64.h>
|
||||
#include "core1/eeprom.h"
|
||||
#include "core1/pfsmanager.h"
|
||||
#include "save.h"
|
||||
|
||||
#define ROUND_UP_DIVIDE(a, b) (((a) + (b) - 1) / (b))
|
||||
|
||||
// The round up divide is not technically needed, but will come in handy for modding
|
||||
#define GAMEFILE_NUM_BLOCKS ROUND_UP_DIVIDE(sizeof(SaveData), EEPROM_BLOCK_SIZE)
|
||||
|
||||
s32 eeprom_writeBlocks(s32 file, s32 offset, void *buffer, s32 count) {
|
||||
s32 address = file * GAMEFILE_NUM_BLOCKS + offset;
|
||||
s32 ret;
|
||||
|
||||
func_8024F35C(3);
|
||||
ret = osEepromLongWrite(pfsManager_getFrameReplyQ(), address, buffer, count * EEPROM_BLOCK_SIZE);
|
||||
func_8024F35C(0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 eeprom_readBlocks(s32 file, s32 offset, void *buffer, s32 count) {
|
||||
s32 address = file * GAMEFILE_NUM_BLOCKS + offset;
|
||||
s32 ret;
|
||||
|
||||
func_8024F35C(3);
|
||||
ret = osEepromLongRead(pfsManager_getFrameReplyQ(), address, buffer, count * EEPROM_BLOCK_SIZE);
|
||||
func_8024F35C(0);
|
||||
|
||||
return ret;
|
||||
}
|
Reference in New Issue
Block a user