diff options
author | red031000 <rubenru09@aol.com> | 2020-05-25 15:04:21 +0100 |
---|---|---|
committer | red031000 <rubenru09@aol.com> | 2020-05-25 15:04:21 +0100 |
commit | 00f7b96e44ef644ec2b5382eda87e3f47c06b436 (patch) | |
tree | 8302c15297a5f7da23494bfbb7d0ddaebcf057f9 | |
parent | 933dc9d738e830e797e16f056b49a3c79bcd8352 (diff) |
almost at the end
-rw-r--r-- | arm9/lib/include/FS_command_default.h | 27 | ||||
-rw-r--r-- | arm9/lib/src/FS_command_default.c | 38 | ||||
-rw-r--r-- | arm9/lib/src/GX_vramcnt.c | 28 |
3 files changed, 52 insertions, 41 deletions
diff --git a/arm9/lib/include/FS_command_default.h b/arm9/lib/include/FS_command_default.h new file mode 100644 index 00000000..1984aeb0 --- /dev/null +++ b/arm9/lib/include/FS_command_default.h @@ -0,0 +1,27 @@ +#ifndef POKEDIAMOND_FS_COMMAND_DEFAULT_H +#define POKEDIAMOND_FS_COMMAND_DEFAULT_H + +#include "types.h" +#include "FS_archive.h" + +typedef struct +{ + FSArchive *arc; + u32 pos; +} FSiSyncReadParam; + + +u32 FSi_StrNICmp(const char * str1, const char * str2, u32 len); +FSResult FSi_ReadTable(FSiSyncReadParam * p, void * dst, u32 len); +FSResult FSi_SeekDirDirect(FSFile * p_dir, u32 id); +FSResult FSi_ReadFileCommand(FSFile * p_file); +FSResult FSi_WriteFileCommand(FSFile * p_file); +FSResult FSi_SeekDirCommand(FSFile * p_dir); +FSResult FSi_ReadDirCommand(FSFile *p_dir); +FSResult FSi_FindPathCommand(FSFile *p_dir); +FSResult FSi_GetPathCommand(FSFile *p_file); +FSResult FSi_OpenFileFastCommand(FSFile * p_file); +FSResult FSi_OpenFileDirectCommand(FSFile * p_file); +FSResult FSi_CloseFileCommand(FSFile * p_file); + +#endif //POKEDIAMOND_FS_COMMAND_DEFAULT_H diff --git a/arm9/lib/src/FS_command_default.c b/arm9/lib/src/FS_command_default.c index 002e1d53..582bf1b2 100644 --- a/arm9/lib/src/FS_command_default.c +++ b/arm9/lib/src/FS_command_default.c @@ -1,27 +1,10 @@ #include "nitro.h" #include "FS_file.h" #include "FS_command.h" -#include "FS_archive.h" #include "MI_byteAccess.h" #include "MI_memory.h" #include "FSi_util.h" - -typedef struct -{ - FSArchive *arc; - u32 pos; -} -FSiSyncReadParam; - -ARM_FUNC FSResult FSi_ReadFileCommand(FSFile * p_file); -ARM_FUNC FSResult FSi_WriteFileCommand(FSFile * p_file); -ARM_FUNC FSResult FSi_SeekDirCommand(FSFile * p_file); -ARM_FUNC FSResult FSi_ReadDirCommand(FSFile * p_file); -ARM_FUNC FSResult FSi_FindPathCommand(FSFile * p_file); -ARM_FUNC FSResult FSi_GetPathCommand(FSFile * p_file); -ARM_FUNC FSResult FSi_OpenFileFastCommand(FSFile * p_file); -ARM_FUNC FSResult FSi_OpenFileDirectCommand(FSFile * p_file); -ARM_FUNC FSResult FSi_CloseFileCommand(FSFile * p_file); +#include "FS_command_default.h" FSResult (*const fsi_default_command[])(FSFile *) = { [FS_COMMAND_READFILE] = FSi_ReadFileCommand, @@ -41,8 +24,8 @@ ARM_FUNC u32 FSi_StrNICmp(const char * str1, const char * str2, u32 len) int i; for (i = 0; i < len; i++) { - u32 c = MI_ReadByte(str1 + i) - 'A'; - u32 d = MI_ReadByte(str2 + i) - 'A'; + u32 c = (u32)(MI_ReadByte(str1 + i) - 'A'); + u32 d = (u32)(MI_ReadByte(str2 + i) - 'A'); if (c <= 'Z' - 'A') c += 'a' - 'A'; if (d <= 'Z' - 'A') @@ -69,7 +52,7 @@ ARM_FUNC FSResult FSi_ReadTable(FSiSyncReadParam * p, void * dst, u32 len) OSIntrMode bak_psr = OS_DisableInterrupts(); while (FSi_IsArchiveSync(p_arc)) OS_SleepThread(&p_arc->sync_q); - OS_RestoreInterrupts(bak_psr); + (void)OS_RestoreInterrupts(bak_psr); ret = p_arc->list.next->error; } break; @@ -216,7 +199,7 @@ ARM_FUNC FSResult FSi_FindPathCommand(FSFile *p_dir) else if ((name_len == 2) & (MI_ReadByte(path + 1) == '.')) { if (p_dir->prop.dir.pos.own_id != 0) - FSi_SeekDirDirect(p_dir, p_dir->prop.dir.parent); + (void)FSi_SeekDirDirect(p_dir, p_dir->prop.dir.parent); path += 2; continue; } @@ -300,7 +283,7 @@ ARM_FUNC FSResult FSi_GetPathCommand(FSFile *p_file) dir_id = INVALID_ID; do { - FSi_SeekDirDirect(&tmp, pos); + (void)FSi_SeekDirDirect(&tmp, pos); if (!pos) num_dir = tmp.prop.dir.parent; tmp.arg.readdir.p_entry = &entry; @@ -337,10 +320,10 @@ ARM_FUNC FSResult FSi_GetPathCommand(FSFile *p_file) id = dir_id; if (id != 0) { - FSi_SeekDirDirect(&tmp, id); + (void)FSi_SeekDirDirect(&tmp, id); do { - FSi_SeekDirDirect(&tmp, tmp.prop.dir.parent); + (void)FSi_SeekDirDirect(&tmp, tmp.prop.dir.parent); tmp.arg.readdir.p_entry = &entry; tmp.arg.readdir.skip_string = TRUE; while (FSi_TranslateCommand(&tmp, FS_COMMAND_READDIR) == FS_RESULT_SUCCESS) @@ -378,7 +361,7 @@ ARM_FUNC FSResult FSi_GetPathCommand(FSFile *p_file) MI_CpuCopy8(":/", dst + pos, 2); pos += 2; id = dir_id; - FSi_SeekDirDirect(&tmp, id); + (void)FSi_SeekDirDirect(&tmp, id); if (file_id != INVALID_ID) { tmp.arg.readdir.p_entry = &entry; @@ -401,7 +384,7 @@ ARM_FUNC FSResult FSi_GetPathCommand(FSFile *p_file) { do { - FSi_SeekDirDirect(&tmp, tmp.prop.dir.parent); + (void)FSi_SeekDirDirect(&tmp, tmp.prop.dir.parent); tmp.arg.readdir.p_entry = &entry; tmp.arg.readdir.skip_string = FALSE; MI_WriteByte(dst + total - 1, '/'); @@ -464,5 +447,6 @@ ARM_FUNC FSResult FSi_OpenFileDirectCommand(FSFile * p_file) ARM_FUNC FSResult FSi_CloseFileCommand(FSFile * p_file) { +#pragma unused (p_file) return FS_RESULT_SUCCESS; } diff --git a/arm9/lib/src/GX_vramcnt.c b/arm9/lib/src/GX_vramcnt.c index 67749301..6dcf34c1 100644 --- a/arm9/lib/src/GX_vramcnt.c +++ b/arm9/lib/src/GX_vramcnt.c @@ -28,7 +28,7 @@ ARM_FUNC void GX_VRAMCNT_SetLCDC_(u32 mask){ ARM_FUNC void GX_SetBankForBG(s32 bg){ gGXState.lcdc = (u16)(~bg & (gGXState.lcdc | gGXState.bg)); - gGXState.bg = bg; + gGXState.bg = (u16)bg; switch (bg) { case 8: @@ -101,7 +101,7 @@ ARM_FUNC void GX_SetBankForBG(s32 bg){ ARM_FUNC void GX_SetBankForOBJ(s32 obj){ gGXState.lcdc = (u16)(~obj & (gGXState.lcdc | gGXState.obj)); - gGXState.obj = obj; + gGXState.obj = (u16)obj; switch (obj) { case 3: @@ -140,7 +140,7 @@ ARM_FUNC void GX_SetBankForOBJ(s32 obj){ ARM_FUNC void GX_SetBankForBGExtPltt(s32 bgextpltt){ gGXState.lcdc = (u16)(~bgextpltt & (gGXState.lcdc | gGXState.bgExtPltt)); - gGXState.bgExtPltt = bgextpltt; + gGXState.bgExtPltt = (u16)bgextpltt; switch (bgextpltt) { case 0x10: @@ -166,7 +166,7 @@ ARM_FUNC void GX_SetBankForBGExtPltt(s32 bgextpltt){ ARM_FUNC void GX_SetBankForOBJExtPltt(s32 objextpltt){ gGXState.lcdc = (u16)(~objextpltt & (gGXState.lcdc | gGXState.objExtPltt)); - gGXState.objExtPltt = objextpltt; + gGXState.objExtPltt = (u16)objextpltt; switch (objextpltt) { case 32: @@ -186,14 +186,14 @@ ARM_FUNC void GX_SetBankForOBJExtPltt(s32 objextpltt){ ARM_FUNC void GX_SetBankForTex(s32 tex){ gGXState.lcdc = (u16)(~tex & (gGXState.lcdc | gGXState.tex)); - gGXState.tex = tex; + gGXState.tex = (u16)tex; if (tex == 0) { reg_G3X_DISP3DCNT &= 0x0000CFFE; } else { - reg_G3X_DISP3DCNT = (reg_G3X_DISP3DCNT & ~0x3000) | 0x1; + reg_G3X_DISP3DCNT = (u16)((reg_G3X_DISP3DCNT & ~0x3000) | 0x1); switch (tex) { case 5: @@ -249,7 +249,7 @@ ARM_FUNC void GX_SetBankForTex(s32 tex){ ARM_FUNC void GX_SetBankForTexPltt(s32 texpltt){ gGXState.lcdc = (u16)(~texpltt & (gGXState.lcdc | gGXState.texPltt)); - gGXState.texPltt = texpltt; + gGXState.texPltt = (u16)texpltt; switch (texpltt) { case 0: //needed to match @@ -275,7 +275,7 @@ ARM_FUNC void GX_SetBankForTexPltt(s32 texpltt){ ARM_FUNC void GX_SetBankForClearImage(s32 clearimage){ gGXState.lcdc = (u16)(~clearimage & (gGXState.lcdc | gGXState.clrImg)); - gGXState.clrImg = clearimage; + gGXState.clrImg = (u16)clearimage; switch (clearimage) { case 3: @@ -306,7 +306,7 @@ ARM_FUNC void GX_SetBankForClearImage(s32 clearimage){ ARM_FUNC void GX_SetBankForARM7(s32 arm7){ gGXState.lcdc = (u16)(~arm7 & (gGXState.lcdc | gGXState.arm7)); - gGXState.arm7 = arm7; + gGXState.arm7 = (u16)arm7; switch (arm7) { case 0: //needed to match @@ -326,12 +326,12 @@ ARM_FUNC void GX_SetBankForARM7(s32 arm7){ ARM_FUNC void GX_SetBankForLCDC(s32 lcdc){ gGXState.lcdc |= lcdc; - GX_VRAMCNT_SetLCDC_(lcdc); + GX_VRAMCNT_SetLCDC_((u32)lcdc); } ARM_FUNC void GX_SetBankForSubBG(s32 subbg){ gGXState.lcdc = (u16)(~subbg & (gGXState.lcdc | gGXState.sub_bg)); - gGXState.sub_bg = subbg; + gGXState.sub_bg = (u16)subbg; switch (subbg) { case 0: //needed to match @@ -350,7 +350,7 @@ ARM_FUNC void GX_SetBankForSubBG(s32 subbg){ ARM_FUNC void GX_SetBankForSubOBJ(s32 subobj){ gGXState.lcdc = (u16)(~subobj & (gGXState.lcdc | gGXState.sub_obj)); - gGXState.sub_obj = subobj; + gGXState.sub_obj = (u16)subobj; switch (subobj) { case 8: @@ -367,7 +367,7 @@ ARM_FUNC void GX_SetBankForSubOBJ(s32 subobj){ ARM_FUNC void GX_SetBankForSubBGExtPltt(s32 subbgextpltt){ gGXState.lcdc = (u16)(~subbgextpltt & (gGXState.lcdc | gGXState.sub_bgExtPltt)); - gGXState.sub_bgExtPltt = subbgextpltt; + gGXState.sub_bgExtPltt = (u16)subbgextpltt; switch (subbgextpltt) { case 128: @@ -383,7 +383,7 @@ ARM_FUNC void GX_SetBankForSubBGExtPltt(s32 subbgextpltt){ ARM_FUNC void GX_SetBankForSubOBJExtPltt(s32 subobjextpltt){ gGXState.lcdc = (u16)(~subobjextpltt & (gGXState.lcdc | gGXState.sub_objExtPltt)); - gGXState.sub_objExtPltt = subobjextpltt; + gGXState.sub_objExtPltt = (u16)subobjextpltt; switch (subobjextpltt) { case 256: |