mirror of
https://github.com/pret/pokediamond.git
synced 2026-09-30 12:26:48 -05:00
Merge branch 'master' of https://github.com/martmists/pokediamond into pikalax_work
This commit is contained in:
2
Makefile
2
Makefile
@@ -183,7 +183,7 @@ OBJCOPY := $(CROSS)objcopy
|
||||
|
||||
# ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o
|
||||
ASFLAGS = -proc arm5te
|
||||
CFLAGS = -O4,p -proc arm946e -fp soft -lang c99 -Cpp_exceptions off -ir include -ir include-mw -ir arm9/lib/include
|
||||
CFLAGS = -O4,p -proc arm946e -fp soft -lang c99 -Cpp_exceptions off -ir include -ir include-mw -ir arm9/lib/include -W all
|
||||
LDFLAGS = -map -nodead -w off -proc v5te -interworking -map -symtab -m _start
|
||||
|
||||
####################### Other Tools #########################
|
||||
|
||||
@@ -83,7 +83,7 @@ OBJCOPY := $(CROSS)objcopy
|
||||
|
||||
# ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm7_thumb.s -o arm7.o
|
||||
ASFLAGS = -proc arm4t -i ..
|
||||
CFLAGS = -O4,p -proc v4t -fp soft -lang c99 -Cpp_exceptions off -ir ../include -ir ../include-mw -ir ../arm9/lib/include # temporary fix while arm7 libos hasn't been decomped
|
||||
CFLAGS = -O4,p -proc v4t -fp soft -lang c99 -Cpp_exceptions off -ir ../include -ir ../include-mw -ir ../arm9/lib/include -W all # temporary fix while arm7 libos hasn't been decomped
|
||||
LDFLAGS = -map -nodead -w off -proc v4t -interworking -map -symtab -m _start
|
||||
|
||||
####################### Other Tools #########################
|
||||
|
||||
@@ -184,8 +184,8 @@ OBJCOPY := $(CROSS)objcopy
|
||||
|
||||
# ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o
|
||||
ASFLAGS = -proc arm5te -i ..
|
||||
CFLAGS = -O4,p -proc arm946e -fp soft -lang c99 -Cpp_exceptions off -ir ../include -ir ../include-mw -ir lib/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE)
|
||||
CXXFLAGS = -O4,p -proc arm946e -fp soft -lang c99 -Cpp_exceptions off -ir ../include -ir ../include-mw -ir lib/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE)
|
||||
CFLAGS = -O4,p -proc arm946e -fp soft -lang c99 -Cpp_exceptions off -ir ../include -ir ../include-mw -ir lib/include -interworking -DFS_IMPLEMENT -enum int -W all -D$(GAME_VERSION) -D$(GAME_LANGUAGE)
|
||||
CXXFLAGS = -O4,p -proc arm946e -fp soft -lang c99 -Cpp_exceptions off -ir ../include -ir ../include-mw -ir lib/include -interworking -DFS_IMPLEMENT -enum int -W all -D$(GAME_VERSION) -D$(GAME_LANGUAGE)
|
||||
LDFLAGS = -map -nodead -w off -proc v5te -interworking -map -symtab -m _start
|
||||
|
||||
####################### Other Tools #########################
|
||||
|
||||
@@ -3,90 +3,6 @@
|
||||
.section .text
|
||||
|
||||
; OS
|
||||
arm_func_start OSi_ReadCardRom32 ;OS_reset.c
|
||||
OSi_ReadCardRom32: ; 01FF8294
|
||||
stmdb sp!, {r4, r5, r6, r7, r8, r9, sl, fp, lr}
|
||||
sub sp, sp, #4
|
||||
ldr r4, _01FF8390
|
||||
ldr r3, _01FF8394
|
||||
ldr r4, [r4]
|
||||
and r3, r0, r3
|
||||
bic r4, r4, #117440512 ; 0x7000000
|
||||
orr sl, r4, #-1593835520 ; 0xa1000000
|
||||
rsb r9, r3, #0
|
||||
ldr r4, _01FF8398
|
||||
_01FF82BC:
|
||||
ldr r3, [r4]
|
||||
ands r3, r3, #-2147483648 ; 0x80000000
|
||||
bne _01FF82BC
|
||||
ldr r3, _01FF839C
|
||||
mov r4, #128 ; 0x80
|
||||
cmp r9, r2
|
||||
addge sp, sp, #4
|
||||
strb r4, [r3]
|
||||
add r0, r0, r9
|
||||
ldmgeia sp!, {r4, r5, r6, r7, r8, r9, sl, fp, lr}
|
||||
bxge lr
|
||||
ldr r3, _01FF83A0
|
||||
ldr ip, _01FF8398
|
||||
ldr r5, _01FF83A4
|
||||
ldr r4, _01FF83A8
|
||||
mov r7, r0, lsr #8
|
||||
mov r6, #183 ; 0xb7
|
||||
mov lr, #0
|
||||
_01FF8304:
|
||||
strb r6, [r5]
|
||||
mov r8, r0, lsr #24
|
||||
strb r8, [r4]
|
||||
ldr r8, _01FF83AC
|
||||
mov fp, r0, lsr #16
|
||||
strb fp, [r8]
|
||||
ldr r8, _01FF83B0
|
||||
strb r7, [r8]
|
||||
ldr r8, _01FF83B4
|
||||
strb r0, [r8]
|
||||
ldr r8, _01FF83B8
|
||||
strb lr, [r8]
|
||||
ldr r8, _01FF83BC
|
||||
strb lr, [r8]
|
||||
ldr r8, _01FF83C0
|
||||
strb lr, [r8]
|
||||
str sl, [ip]
|
||||
_01FF8348:
|
||||
ldr r8, [ip]
|
||||
ands fp, r8, #8388608 ; 0x800000
|
||||
beq _01FF836C
|
||||
cmp r9, #0
|
||||
ldr fp, [r3]
|
||||
blt _01FF8368
|
||||
cmp r9, r2
|
||||
strlt fp, [r1, r9]
|
||||
_01FF8368:
|
||||
add r9, r9, #4
|
||||
_01FF836C:
|
||||
ands r8, r8, #-2147483648 ; 0x80000000
|
||||
bne _01FF8348
|
||||
cmp r9, r2
|
||||
add r7, r7, #2
|
||||
add r0, r0, #512 ; 0x200
|
||||
blt _01FF8304
|
||||
add sp, sp, #4
|
||||
ldmia sp!, {r4, r5, r6, r7, r8, r9, sl, fp, lr}
|
||||
bx lr
|
||||
_01FF8390: .word 0x027FFE60
|
||||
_01FF8394: .word 0x000001FF
|
||||
_01FF8398: .word 0x040001A4
|
||||
_01FF839C: .word 0x040001A1
|
||||
_01FF83A0: .word 0x04100010
|
||||
_01FF83A4: .word 0x040001A8
|
||||
_01FF83A8: .word 0x040001A9
|
||||
_01FF83AC: .word 0x040001AA
|
||||
_01FF83B0: .word 0x040001AB
|
||||
_01FF83B4: .word 0x040001AC
|
||||
_01FF83B8: .word 0x040001AD
|
||||
_01FF83BC: .word 0x040001AE
|
||||
_01FF83C0: .word 0x040001AF
|
||||
|
||||
arm_func_start OSi_ReloadRomData ;OS_reset.c
|
||||
OSi_ReloadRomData: ; 0x01FF83C4
|
||||
stmdb sp!, {r4, r5, r6, r7, r8, r9, sl, fp, lr}
|
||||
|
||||
@@ -7289,6 +7289,7 @@
|
||||
.extern OSi_MainExArenaEnabled
|
||||
.extern OSi_NeedResetTimer
|
||||
.extern OSi_PreviousVCount
|
||||
.extern OSi_ReadCardRom32
|
||||
.extern OSi_ReferSymbol
|
||||
.extern OSi_RemoveMutexLinkFromQueue
|
||||
.extern OSi_RescheduleCount
|
||||
|
||||
@@ -18,6 +18,7 @@ static void OSi_SendToPxi(u16 data);
|
||||
void OS_ResetSystem(u32 parameter);
|
||||
void OSi_DoBoot(void);
|
||||
static void OSi_CpuClear32(register u32 data, register void *destp, register u32 size);
|
||||
void OSi_ReadCardRom32(u32 src, void *dst, s32 len);
|
||||
|
||||
static inline u32 OS_GetResetParameter(void)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ struct SNDBinaryFileHeader {
|
||||
typedef struct SNDBinaryBlockHeader {
|
||||
u32 type; // 0x0
|
||||
u32 size; // 0x4
|
||||
}; // size = 0x8
|
||||
} SNDBinaryBlockHeader; // size = 0x8
|
||||
|
||||
struct SNDWaveParam {
|
||||
u8 format; // 0x0
|
||||
|
||||
@@ -98,9 +98,12 @@
|
||||
#define reg_PXI_SEND_FIFO (*(REGType32v *)0x4000188)
|
||||
|
||||
#define reg_MI_MCCNT0 (*(REGType16v *)0x40001a0)
|
||||
#define reg_CARD_MASTERCNT (*(REGType8v *)0x40001a1) //?
|
||||
#define reg_MI_MCD0 (*(REGType16v *)0x40001a2)
|
||||
#define reg_MI_MCCNT1 (*(REGType32v *)0x40001a4)
|
||||
#define reg_CARD_CNT (*(REGType32v *)0x40001a4) //?
|
||||
#define reg_MI_MCCMD0 (*(REGType32v *)0x40001a8)
|
||||
#define reg_CARD_CMD (*(REGType8v *)0x40001a8) //?
|
||||
#define reg_MI_MCCMD1 (*(REGType32v *)0x40001ac)
|
||||
#define reg_MI_EXMEMCNT (*(REGType16v *)0x4000204)
|
||||
|
||||
@@ -355,6 +358,7 @@
|
||||
#define reg_PXI_RECV_FIFO (*(REGType32v *)0x4100000)
|
||||
|
||||
#define reg_MI_MCD1 (*(REGType32v *)0x4100010)
|
||||
#define reg_CARD_DATA (*(REGType32v *)0x4100010) //?
|
||||
|
||||
#define REG_PAD_KEYINPUT_L_SHIFT 9
|
||||
#define REG_PAD_KEYINPUT_L_SIZE 1
|
||||
|
||||
@@ -121,4 +121,67 @@ _01FF8284:
|
||||
blt _01FF8284
|
||||
bx lr
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
CARD_MASTER_SELECT_ROM = 0x0,
|
||||
CARD_MASTER_ENABLE = 0x80,
|
||||
CARD_CMD_READ_PAGE = 0xb7,
|
||||
CARD_CTRL_CMD_MASK = 0x07000000,
|
||||
CARD_CTRL_CMD_PAGE = 0x01000000,
|
||||
CARD_CTRL_READ = 0x00000000,
|
||||
CARD_CTRL_RESET_HI = 0x20000000,
|
||||
CARD_CTRL_START = 0x80000000,
|
||||
CARD_CTRL_READY = 0x00800000,
|
||||
CARD_ENUM_END
|
||||
};
|
||||
|
||||
void OSi_ReadCardRom32(u32 src, void *dst, s32 len) //should be static, can't mark as such
|
||||
{
|
||||
vu32 *const hdr_GAME_BUF = (vu32 *)(HW_ROM_HEADER_BUF + 0x60);
|
||||
|
||||
const u32 ctrl_start = (u32)((*hdr_GAME_BUF &~CARD_CTRL_CMD_MASK)
|
||||
| (CARD_CTRL_CMD_PAGE | CARD_CTRL_READ
|
||||
| CARD_CTRL_START | CARD_CTRL_RESET_HI));
|
||||
|
||||
s32 pos = -(s32)(src & 511);
|
||||
|
||||
while (reg_CARD_CNT & CARD_CTRL_START) {}
|
||||
reg_CARD_MASTERCNT = (u32)(CARD_MASTER_SELECT_ROM | CARD_MASTER_ENABLE);
|
||||
|
||||
for (src = (u32)(src + pos); pos < len; src += 512)
|
||||
{
|
||||
(®_CARD_CMD)[0] = (u8)(CARD_CMD_READ_PAGE);
|
||||
(®_CARD_CMD)[1] = (u8)(src >> 24);
|
||||
(®_CARD_CMD)[2] = (u8)(src >> 16);
|
||||
(®_CARD_CMD)[3] = (u8)(src >> 8);
|
||||
(®_CARD_CMD)[4] = (u8)(src >> 0);
|
||||
(®_CARD_CMD)[5] = 0;
|
||||
(®_CARD_CMD)[6] = 0;
|
||||
(®_CARD_CMD)[7] = 0;
|
||||
|
||||
reg_CARD_CNT = ctrl_start;
|
||||
for (;;)
|
||||
{
|
||||
u32 ctrl = reg_CARD_CNT;
|
||||
|
||||
if ((ctrl & CARD_CTRL_READY))
|
||||
{
|
||||
const u32 data = reg_CARD_DATA;
|
||||
|
||||
if ((pos >= 0) && (pos < len))
|
||||
{
|
||||
*(u32 *)((u32)dst + pos) = data;
|
||||
}
|
||||
|
||||
pos += sizeof(u32);
|
||||
}
|
||||
|
||||
if (!(ctrl & CARD_CTRL_START))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma section ITCM end
|
||||
|
||||
@@ -4,6 +4,7 @@ struct AlarmCallback {
|
||||
SNDAlarmCallback cb;
|
||||
void *data;
|
||||
u8 id;
|
||||
u8 padding[3];
|
||||
};
|
||||
|
||||
static struct AlarmCallback sCallbackTable[SND_ALARM_COUNT];
|
||||
|
||||
@@ -95,6 +95,7 @@ ARM_FUNC void SND_DestroyWaveArc(struct SNDWaveArc *waveArc) {
|
||||
}
|
||||
|
||||
ARM_FUNC struct SNDInstPos SND_GetFirstInstDataPos(const struct SNDBankData *bankData) {
|
||||
#pragma unused (bankData)
|
||||
struct SNDInstPos retval;
|
||||
retval.program = 0;
|
||||
retval.index = 0;
|
||||
|
||||
@@ -21,6 +21,7 @@ static struct SNDCommand *sFreeList;
|
||||
extern s32 PXI_SendWordByFifo(u32, u32, u32);
|
||||
extern void PXI_SetFifoRecvCallback(u32, void (*)(s32, s32));
|
||||
extern BOOL PXI_IsCallbackReady(u32, u32);
|
||||
extern void DC_FlushRange(void*, u32);
|
||||
|
||||
static void InitPXI(void);
|
||||
static void RequestCommandProc(void);
|
||||
@@ -52,7 +53,7 @@ ARM_FUNC void SND_CommandInit(void) {
|
||||
cmd->id = SND_CMD_SET_SHARED_WORK;
|
||||
cmd->arg[0] = (u32)SNDi_SharedWork;
|
||||
SND_PushCommand(cmd);
|
||||
SND_FlushCommand(SND_CMD_FLAG_BLOCK);
|
||||
(void)SND_FlushCommand(SND_CMD_FLAG_BLOCK);
|
||||
}
|
||||
|
||||
ARM_FUNC const struct SNDCommand *SND_RecvCommandReply(u32 flags) {
|
||||
@@ -61,7 +62,7 @@ ARM_FUNC const struct SNDCommand *SND_RecvCommandReply(u32 flags) {
|
||||
if (flags & SND_CMD_FLAG_BLOCK) {
|
||||
u32 tag = SNDi_GetFinishedCommandTag();
|
||||
while (sFinishedTag == tag) {
|
||||
OS_RestoreInterrupts(oldirq);
|
||||
(void)OS_RestoreInterrupts(oldirq);
|
||||
OS_SpinWait(100);
|
||||
oldirq = OS_DisableInterrupts();
|
||||
tag = SNDi_GetFinishedCommandTag();
|
||||
@@ -69,7 +70,7 @@ ARM_FUNC const struct SNDCommand *SND_RecvCommandReply(u32 flags) {
|
||||
} else {
|
||||
u32 tag = SNDi_GetFinishedCommandTag();
|
||||
if (sFinishedTag == tag) {
|
||||
OS_RestoreInterrupts(oldirq);
|
||||
(void)OS_RestoreInterrupts(oldirq);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -93,7 +94,7 @@ ARM_FUNC const struct SNDCommand *SND_RecvCommandReply(u32 flags) {
|
||||
sWaitingCommandListCount--;
|
||||
sFinishedTag++;
|
||||
|
||||
OS_RestoreInterrupts(oldirq);
|
||||
(void)OS_RestoreInterrupts(oldirq);
|
||||
return queueRead;
|
||||
}
|
||||
|
||||
@@ -116,13 +117,13 @@ ARM_FUNC struct SNDCommand *SND_AllocCommand(u32 flags) {
|
||||
if (cmd != NULL)
|
||||
return cmd;
|
||||
} else {
|
||||
SND_FlushCommand(SND_CMD_FLAG_BLOCK);
|
||||
(void)SND_FlushCommand(SND_CMD_FLAG_BLOCK);
|
||||
}
|
||||
|
||||
RequestCommandProc();
|
||||
|
||||
do {
|
||||
SND_RecvCommandReply(SND_CMD_FLAG_BLOCK);
|
||||
(void)SND_RecvCommandReply(SND_CMD_FLAG_BLOCK);
|
||||
cmd = AllocCommand();
|
||||
} while (cmd == NULL);
|
||||
return cmd;
|
||||
@@ -142,25 +143,25 @@ ARM_FUNC void SND_PushCommand(struct SNDCommand *cmd) {
|
||||
|
||||
cmd->llNext = NULL;
|
||||
|
||||
OS_RestoreInterrupts(oldirq);
|
||||
(void)OS_RestoreInterrupts(oldirq);
|
||||
}
|
||||
|
||||
ARM_FUNC BOOL SND_FlushCommand(u32 flags) {
|
||||
OSIntrMode oldirq = OS_DisableInterrupts();
|
||||
|
||||
if (sReserveList == NULL) {
|
||||
OS_RestoreInterrupts(oldirq);
|
||||
(void)OS_RestoreInterrupts(oldirq);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (sWaitingCommandListCount >= SND_CMD_WAIT_QUEUE_COUNT) {
|
||||
if ((flags & SND_CMD_FLAG_BLOCK) == 0) {
|
||||
OS_RestoreInterrupts(oldirq);
|
||||
(void)OS_RestoreInterrupts(oldirq);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
do {
|
||||
SND_RecvCommandReply(SND_CMD_FLAG_BLOCK);
|
||||
(void)SND_RecvCommandReply(SND_CMD_FLAG_BLOCK);
|
||||
} while (sWaitingCommandListCount >= SND_CMD_WAIT_QUEUE_COUNT);
|
||||
}
|
||||
|
||||
@@ -169,13 +170,13 @@ ARM_FUNC BOOL SND_FlushCommand(u32 flags) {
|
||||
s32 result = PXI_SendWordByFifo(7, (u32)sReserveList, 0);
|
||||
if (result < 0) {
|
||||
if ((flags & SND_CMD_FLAG_BLOCK) == 0) {
|
||||
OS_RestoreInterrupts(oldirq);
|
||||
(void)OS_RestoreInterrupts(oldirq);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
result = PXI_SendWordByFifo(7, (u32)sReserveList, 0);
|
||||
while (result < 0) {
|
||||
OS_RestoreInterrupts(oldirq);
|
||||
(void)OS_RestoreInterrupts(oldirq);
|
||||
OS_SpinWait(100);
|
||||
oldirq = OS_DisableInterrupts();
|
||||
result = PXI_SendWordByFifo(7, (u32)sReserveList, 0);
|
||||
@@ -197,7 +198,7 @@ ARM_FUNC BOOL SND_FlushCommand(u32 flags) {
|
||||
sWaitingCommandListCount++;
|
||||
sCurrentTag++;
|
||||
|
||||
OS_RestoreInterrupts(oldirq);
|
||||
(void)OS_RestoreInterrupts(oldirq);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -216,7 +217,7 @@ ARM_FUNC void SND_WaitForCommandProc(u32 tag) {
|
||||
return;
|
||||
|
||||
do {
|
||||
SND_RecvCommandReply(SND_CMD_FLAG_BLOCK);
|
||||
(void)SND_RecvCommandReply(SND_CMD_FLAG_BLOCK);
|
||||
} while (SND_IsFinishedCommandTag(tag) == 0);
|
||||
}
|
||||
|
||||
@@ -229,7 +230,7 @@ ARM_FUNC u32 SND_GetCurrentCommandTag(void) {
|
||||
else
|
||||
retval = sCurrentTag;
|
||||
|
||||
OS_RestoreInterrupts(oldirq);
|
||||
(void)OS_RestoreInterrupts(oldirq);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -249,7 +250,7 @@ ARM_FUNC BOOL SND_IsFinishedCommandTag(u32 tag) {
|
||||
result = FALSE;
|
||||
}
|
||||
|
||||
OS_RestoreInterrupts(oldirq);
|
||||
(void)OS_RestoreInterrupts(oldirq);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -260,7 +261,7 @@ ARM_FUNC s32 SND_CountFreeCommand(void) {
|
||||
for (struct SNDCommand *cmd = sFreeList; cmd != NULL; cmd = cmd->llNext)
|
||||
count++;
|
||||
|
||||
OS_RestoreInterrupts(oldirq);
|
||||
(void)OS_RestoreInterrupts(oldirq);
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -271,7 +272,7 @@ ARM_FUNC s32 SND_CountReservedCommand(void) {
|
||||
for (struct SNDCommand *cmd = sReserveList; cmd != NULL; cmd = cmd->llNext)
|
||||
count++;
|
||||
|
||||
OS_RestoreInterrupts(oldirq);
|
||||
(void)OS_RestoreInterrupts(oldirq);
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -280,9 +281,10 @@ ARM_FUNC s32 SND_CountWaitingCommand(void) {
|
||||
}
|
||||
|
||||
ARM_FUNC static void PxiFifoCallback(s32 a, s32 b) {
|
||||
#pragma unused (a)
|
||||
OSIntrMode oldirq = OS_DisableInterrupts();
|
||||
SNDi_CallAlarmHandler(b);
|
||||
OS_RestoreInterrupts(oldirq);
|
||||
(void)OS_RestoreInterrupts(oldirq);
|
||||
}
|
||||
|
||||
ARM_FUNC static void InitPXI(void) {
|
||||
@@ -306,7 +308,7 @@ ARM_FUNC static void RequestCommandProc(void) {
|
||||
ARM_FUNC static struct SNDCommand *AllocCommand(void) {
|
||||
OSIntrMode oldirq = OS_DisableInterrupts();
|
||||
if (sFreeList == NULL) {
|
||||
OS_RestoreInterrupts(oldirq);
|
||||
(void)OS_RestoreInterrupts(oldirq);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -315,7 +317,7 @@ ARM_FUNC static struct SNDCommand *AllocCommand(void) {
|
||||
sFreeList = sFreeList->llNext;
|
||||
if (sFreeList == NULL)
|
||||
sFreeListEnd = NULL;
|
||||
OS_RestoreInterrupts(oldirq);
|
||||
(void)OS_RestoreInterrupts(oldirq);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -328,6 +330,6 @@ ARM_FUNC static BOOL IsCommandAvailable(void) {
|
||||
// is this some kind of debug or ensata register?
|
||||
*(vu32 *)0x4FFF200 = 0x10;
|
||||
u32 resp = *(vu32 *)0x4FFF200;
|
||||
OS_RestoreInterrupts(oldirq);
|
||||
(void)OS_RestoreInterrupts(oldirq);
|
||||
return resp != 0;
|
||||
}
|
||||
|
||||
@@ -30,11 +30,11 @@ ARM_FUNC void SND_PauseSeq(s32 player, BOOL flag) {
|
||||
// ARM_FUNC void SND_SetPlayerTempoRatio(s32 player, s32 ratio) { }
|
||||
|
||||
ARM_FUNC void SND_SetPlayerVolume(s32 player, s32 volume) {
|
||||
SNDi_SetPlayerParam(player, 6, volume, 2);
|
||||
SNDi_SetPlayerParam(player, 6, (u32)volume, 2);
|
||||
}
|
||||
|
||||
ARM_FUNC void SND_SetPlayerChannelPriority(s32 player, s32 prio) {
|
||||
SNDi_SetPlayerParam(player, 4, prio, 1);
|
||||
SNDi_SetPlayerParam(player, 4, (u32)prio, 1);
|
||||
}
|
||||
|
||||
// ARM_FUNC void SND_SetPlayerLocalVariable(s32 player, s32 varNo, s16 var) { }
|
||||
@@ -44,11 +44,11 @@ ARM_FUNC void SND_SetPlayerChannelPriority(s32 player, s32 prio) {
|
||||
// ARM_FUNC void SND_SetTrackVolume(s32 player, u32 trackBitMask, s32 volume) { }
|
||||
|
||||
ARM_FUNC void SND_SetTrackPitch(s32 player, u32 trackBitMask, s32 pitch) {
|
||||
SNDi_SetTrackParam(player, trackBitMask, 12, pitch, 2);
|
||||
SNDi_SetTrackParam(player, trackBitMask, 12, (u32)pitch, 2);
|
||||
}
|
||||
|
||||
ARM_FUNC void SND_SetTrackPan(s32 player, u32 trackBitMask, s32 pan) {
|
||||
SNDi_SetTrackParam(player, trackBitMask, 9, pan, 1);
|
||||
SNDi_SetTrackParam(player, trackBitMask, 9, (u32)pan, 1);
|
||||
}
|
||||
|
||||
ARM_FUNC void SND_SetTrackAllocatableChannel(s32 player, u32 trackBitMask, u32 chnBitMask) {
|
||||
@@ -65,7 +65,7 @@ ARM_FUNC void SND_StopTimer(u32 chnBitMask, u32 capBitMask, u32 alarmBitMask, u3
|
||||
|
||||
while (i < SND_ALARM_COUNT && tmpMask != 0) {
|
||||
if (tmpMask & 1)
|
||||
SNDi_IncAlarmId(i);
|
||||
SNDi_IncAlarmId((u32)i);
|
||||
i++;
|
||||
tmpMask >>= 1;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ ARM_FUNC void SND_SetupCapture(s32 capture, s32 format, void *bufferPtr, u32 len
|
||||
}
|
||||
|
||||
ARM_FUNC void SND_SetupAlarm(s32 alarm, u32 tick, u32 period, SNDAlarmCallback cb, void *userData) {
|
||||
PushCmd4(SND_CMD_SETUP_ALARM, alarm, tick, period, SNDi_SetAlarmHandler(alarm, cb, userData));
|
||||
PushCmd4(SND_CMD_SETUP_ALARM, alarm, tick, period, SNDi_SetAlarmHandler((u32)alarm, cb, userData));
|
||||
}
|
||||
|
||||
// ARM_FUNC void SND_SetTrackMute(s32 player, u32 trackBitMask, BOOL flag) { }
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include "SND_main.h"
|
||||
#include "SND_command.h"
|
||||
#include "SND_alarm.h"
|
||||
|
||||
#include "global.h"
|
||||
#include "OS_mutex.h"
|
||||
@@ -7,6 +9,7 @@ static struct OSMutex sSndMutex;
|
||||
static s32 sSndInitialized;
|
||||
|
||||
// TODO remove these declarations once we have the functions in the headers
|
||||
void OS_InitMutex(struct OSMutex *);
|
||||
void OS_UnlockMutex(struct OSMutex *);
|
||||
void OS_LockMutex(struct OSMutex *);
|
||||
|
||||
|
||||
@@ -172,27 +172,27 @@ THUMB_FUNC void ReadFromNarcMemberByPathAndId(void * dest, const char * path, s3
|
||||
FS_SeekFile(&file, 12, FS_SEEK_SET);
|
||||
FS_ReadFile(&file, &chunk_size, 2);
|
||||
chunk_starts[0] = chunk_size;
|
||||
FS_SeekFile(&file, chunk_starts[0] + 4, FS_SEEK_SET);
|
||||
FS_SeekFile(&file, (s32)(chunk_starts[0] + 4), FS_SEEK_SET);
|
||||
FS_ReadFile(&file, &chunk_size, 4);
|
||||
FS_ReadFile(&file, &num_files, 2);
|
||||
if (num_files <= file_idx)
|
||||
ErrorHandling();
|
||||
chunk_starts[1] = chunk_starts[0] + chunk_size;
|
||||
FS_SeekFile(&file, chunk_starts[1] + 4, FS_SEEK_SET);
|
||||
FS_SeekFile(&file, (s32)(chunk_starts[1] + 4), FS_SEEK_SET);
|
||||
FS_ReadFile(&file, &chunk_size, 4);
|
||||
btnf_size = chunk_size;
|
||||
FS_SeekFile(&file, chunk_starts[0] + 12 + 8 * file_idx, FS_SEEK_SET);
|
||||
FS_SeekFile(&file, (s32)(chunk_starts[0] + 12 + 8 * file_idx), FS_SEEK_SET);
|
||||
FS_ReadFile(&file, &file_start, 4);
|
||||
FS_ReadFile(&file, &file_end, 4);
|
||||
chunk_starts[2] = chunk_starts[1] + btnf_size;
|
||||
FS_SeekFile(&file, chunk_starts[2] + 8 + file_start + offset, FS_SEEK_SET);
|
||||
FS_SeekFile(&file, (s32)(chunk_starts[2] + 8 + file_start + offset), FS_SEEK_SET);
|
||||
if (size == 0)
|
||||
chunk_size = file_end - file_start;
|
||||
else
|
||||
chunk_size = size;
|
||||
if (chunk_size == 0)
|
||||
ErrorHandling();
|
||||
FS_ReadFile(&file, dest, chunk_size);
|
||||
FS_ReadFile(&file, dest, (s32)chunk_size);
|
||||
FS_CloseFile(&file);
|
||||
}
|
||||
|
||||
@@ -213,20 +213,20 @@ THUMB_FUNC void * AllocAndReadFromNarcMemberByPathAndId(const char * path, s32 f
|
||||
FS_SeekFile(&file, 12, FS_SEEK_SET);
|
||||
FS_ReadFile(&file, &chunk_size, 2);
|
||||
chunk_starts[0] = chunk_size;
|
||||
FS_SeekFile(&file, chunk_starts[0] + 4, FS_SEEK_SET);
|
||||
FS_SeekFile(&file, (s32)(chunk_starts[0] + 4), FS_SEEK_SET);
|
||||
FS_ReadFile(&file, &chunk_size, 4);
|
||||
FS_ReadFile(&file, &num_files, 2);
|
||||
if (num_files <= file_idx)
|
||||
ErrorHandling();
|
||||
chunk_starts[1] = chunk_starts[0] + chunk_size;
|
||||
FS_SeekFile(&file, chunk_starts[1] + 4, FS_SEEK_SET);
|
||||
FS_SeekFile(&file, (s32)(chunk_starts[1] + 4), FS_SEEK_SET);
|
||||
FS_ReadFile(&file, &chunk_size, 4);
|
||||
btnf_size = chunk_size;
|
||||
FS_SeekFile(&file, chunk_starts[0] + 12 + 8 * file_idx, FS_SEEK_SET);
|
||||
FS_SeekFile(&file, (s32)(chunk_starts[0] + 12 + 8 * file_idx), FS_SEEK_SET);
|
||||
FS_ReadFile(&file, &file_start, 4);
|
||||
FS_ReadFile(&file, &file_end, 4);
|
||||
chunk_starts[2] = chunk_starts[1] + btnf_size;
|
||||
FS_SeekFile(&file, chunk_starts[2] + 8 + file_start + offset, FS_SEEK_SET);
|
||||
FS_SeekFile(&file, (s32)(chunk_starts[2] + 8 + file_start + offset), FS_SEEK_SET);
|
||||
if (size == 0)
|
||||
chunk_size = file_end - file_start;
|
||||
else
|
||||
@@ -242,7 +242,7 @@ THUMB_FUNC void * AllocAndReadFromNarcMemberByPathAndId(const char * path, s32 f
|
||||
dest = AllocFromHeapAtEnd(heap_id, chunk_size);
|
||||
break;
|
||||
}
|
||||
FS_ReadFile(&file, dest, chunk_size);
|
||||
FS_ReadFile(&file, dest, (s32)chunk_size);
|
||||
FS_CloseFile(&file);
|
||||
return dest;
|
||||
}
|
||||
@@ -293,20 +293,20 @@ THUMB_FUNC u32 GetNarcMemberSizeByIdPair(NarcId narc_id, s32 file_idx)
|
||||
FS_SeekFile(&file, 12, FS_SEEK_SET);
|
||||
FS_ReadFile(&file, &chunk_size, 2);
|
||||
chunk_starts[0] = chunk_size;
|
||||
FS_SeekFile(&file, chunk_starts[0] + 4, FS_SEEK_SET);
|
||||
FS_SeekFile(&file, (s32)(chunk_starts[0] + 4), FS_SEEK_SET);
|
||||
FS_ReadFile(&file, &chunk_size, 4);
|
||||
FS_ReadFile(&file, &num_files, 2);
|
||||
if (num_files <= file_idx)
|
||||
ErrorHandling();
|
||||
chunk_starts[1] = chunk_starts[0] + chunk_size;
|
||||
FS_SeekFile(&file, chunk_starts[1] + 4, FS_SEEK_SET);
|
||||
FS_SeekFile(&file, (s32)(chunk_starts[1] + 4), FS_SEEK_SET);
|
||||
FS_ReadFile(&file, &chunk_size, 4);
|
||||
btnf_size = chunk_size;
|
||||
FS_SeekFile(&file, chunk_starts[0] + 12 + 8 * file_idx, FS_SEEK_SET);
|
||||
FS_SeekFile(&file, (s32)(chunk_starts[0] + 12 + 8 * file_idx), FS_SEEK_SET);
|
||||
FS_ReadFile(&file, &file_start, 4);
|
||||
FS_ReadFile(&file, &file_end, 4);
|
||||
chunk_starts[2] = chunk_starts[1] + btnf_size;
|
||||
FS_SeekFile(&file, chunk_starts[2] + 8 + file_start + 0, FS_SEEK_SET);
|
||||
FS_SeekFile(&file, (s32)(chunk_starts[2] + 8 + file_start + 0), FS_SEEK_SET);
|
||||
chunk_size = file_end - file_start;
|
||||
if (chunk_size == 0)
|
||||
ErrorHandling();
|
||||
@@ -326,11 +326,11 @@ THUMB_FUNC NARC * NARC_ctor(NarcId narc_id, u32 heap_id)
|
||||
FS_OpenFile(&narc->file, sNarcFileList[narc_id]);
|
||||
FS_SeekFile(&narc->file, 12, FS_SEEK_SET);
|
||||
FS_ReadFile(&narc->file, &narc->btaf_start, 2);
|
||||
FS_SeekFile(&narc->file, narc->btaf_start + 4, FS_SEEK_SET);
|
||||
FS_SeekFile(&narc->file, (s32)(narc->btaf_start + 4), FS_SEEK_SET);
|
||||
FS_ReadFile(&narc->file, &chunk_size, 4);
|
||||
FS_ReadFile(&narc->file, &narc->num_files, 2);
|
||||
btnf_start = narc->btaf_start + chunk_size;
|
||||
FS_SeekFile(&narc->file, btnf_start + 4, FS_SEEK_SET);
|
||||
FS_SeekFile(&narc->file, (s32)(btnf_start + 4), FS_SEEK_SET);
|
||||
FS_ReadFile(&narc->file, &chunk_size, 4);
|
||||
narc->gmif_start = btnf_start + chunk_size;
|
||||
}
|
||||
@@ -350,14 +350,14 @@ THUMB_FUNC void * NARC_AllocAndReadWholeMember(NARC * narc, u32 file_id, u32 hea
|
||||
void * dest;
|
||||
if (narc->num_files <= file_id)
|
||||
ErrorHandling();
|
||||
FS_SeekFile(&narc->file, narc->btaf_start + 12 + 8 * file_id, FS_SEEK_SET);
|
||||
FS_SeekFile(&narc->file, (s32)(narc->btaf_start + 12 + 8 * file_id), FS_SEEK_SET);
|
||||
FS_ReadFile(&narc->file, &file_start, 4);
|
||||
FS_ReadFile(&narc->file, &file_end, 4);
|
||||
FS_SeekFile(&narc->file, narc->gmif_start + 8 + file_start, FS_SEEK_SET);
|
||||
FS_SeekFile(&narc->file, (s32)(narc->gmif_start + 8 + file_start), FS_SEEK_SET);
|
||||
dest = AllocFromHeap(heap_id, file_end - file_start);
|
||||
if (dest != NULL)
|
||||
{
|
||||
FS_ReadFile(&narc->file, dest, file_end - file_start);
|
||||
FS_ReadFile(&narc->file, dest, (s32)(file_end - file_start));
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
@@ -368,11 +368,11 @@ THUMB_FUNC void NARC_ReadWholeMember(NARC * narc, u32 file_id, void * dest)
|
||||
u32 file_end;
|
||||
if (narc->num_files <= file_id)
|
||||
ErrorHandling();
|
||||
FS_SeekFile(&narc->file, narc->btaf_start + 12 + 8 * file_id, FS_SEEK_SET);
|
||||
FS_SeekFile(&narc->file, (s32)(narc->btaf_start + 12 + 8 * file_id), FS_SEEK_SET);
|
||||
FS_ReadFile(&narc->file, &file_start, 4);
|
||||
FS_ReadFile(&narc->file, &file_end, 4);
|
||||
FS_SeekFile(&narc->file, narc->gmif_start + 8 + file_start, FS_SEEK_SET);
|
||||
FS_ReadFile(&narc->file, dest, file_end - file_start);
|
||||
FS_SeekFile(&narc->file, (s32)(narc->gmif_start + 8 + file_start), FS_SEEK_SET);
|
||||
FS_ReadFile(&narc->file, dest, (s32)(file_end - file_start));
|
||||
}
|
||||
|
||||
THUMB_FUNC u32 NARC_GetMemberSize(NARC * narc, u32 file_id)
|
||||
@@ -381,7 +381,7 @@ THUMB_FUNC u32 NARC_GetMemberSize(NARC * narc, u32 file_id)
|
||||
u32 file_end;
|
||||
if (narc->num_files <= file_id)
|
||||
ErrorHandling();
|
||||
FS_SeekFile(&narc->file, narc->btaf_start + 12 + 8 * file_id, FS_SEEK_SET);
|
||||
FS_SeekFile(&narc->file, (s32)(narc->btaf_start + 12 + 8 * file_id), FS_SEEK_SET);
|
||||
FS_ReadFile(&narc->file, &file_start, 4);
|
||||
FS_ReadFile(&narc->file, &file_end, 4);
|
||||
return file_end - file_start;
|
||||
@@ -392,15 +392,15 @@ THUMB_FUNC void NARC_ReadFromMember(NARC * narc, u32 file_id, u32 pos, u32 size,
|
||||
u32 file_start;
|
||||
if (narc->num_files <= file_id)
|
||||
ErrorHandling();
|
||||
FS_SeekFile(&narc->file, narc->btaf_start + 12 + 8 * file_id, FS_SEEK_SET);
|
||||
FS_SeekFile(&narc->file, (s32)(narc->btaf_start + 12 + 8 * file_id), FS_SEEK_SET);
|
||||
FS_ReadFile(&narc->file, &file_start, 4);
|
||||
FS_SeekFile(&narc->file, narc->gmif_start + 8 + file_start + pos, FS_SEEK_SET);
|
||||
FS_ReadFile(&narc->file, dest, size);
|
||||
FS_SeekFile(&narc->file, (s32)(narc->gmif_start + 8 + file_start + pos), FS_SEEK_SET);
|
||||
FS_ReadFile(&narc->file, dest, (s32)size);
|
||||
}
|
||||
|
||||
THUMB_FUNC void NARC_ReadFile(NARC * narc, u32 size, void * dest)
|
||||
{
|
||||
FS_ReadFile(&narc->file, dest, size);
|
||||
FS_ReadFile(&narc->file, dest, (s32)size);
|
||||
}
|
||||
|
||||
THUMB_FUNC u16 NARC_GetFileCount(NARC * narc)
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
#include "poke_overlay.h"
|
||||
#include "heap.h"
|
||||
|
||||
struct UnkStruct_02006234 * FUN_02006234(struct Unk21DBE18 * ovly_mgr, int * a1, u32 heap_id); //todo header?
|
||||
void FUN_02006260(struct UnkStruct_02006234 * a0);
|
||||
void * FUN_02006268(struct UnkStruct_02006234 * a0, u32 size, u32 heap_id);
|
||||
void * FUN_02006278(struct UnkStruct_02006234 * a0);
|
||||
void FUN_0200627C(struct UnkStruct_02006234 * a0);
|
||||
int * FUN_0200628C(struct UnkStruct_02006234 * a0);
|
||||
BOOL FUN_02006290(struct UnkStruct_02006234 * a0);
|
||||
|
||||
THUMB_FUNC struct UnkStruct_02006234 * FUN_02006234(struct Unk21DBE18 * ovly_mgr, int * a1, u32 heap_id)
|
||||
{
|
||||
struct UnkStruct_02006234 * ret = (struct UnkStruct_02006234 *)AllocFromHeap(heap_id, sizeof(struct UnkStruct_02006234));
|
||||
|
||||
Reference in New Issue
Block a user