Browse Source

disable help menu and increase audio samplerate to 31536 Hz

ipatix 7 years ago
parent
commit
c207d7e493
2 changed files with 50 additions and 8 deletions
  1. 30
    2
      patches/hooks.asm
  2. 20
    6
      src/music/main_mixer.s

+ 30
- 2
patches/hooks.asm View File

12
     .word  0x0203E000   // new PCM work area
12
     .word  0x0203E000   // new PCM work area
13
 .org 0x081DD0C8
13
 .org 0x081DD0C8
14
      // set correct sound driver operation mode
14
      // set correct sound driver operation mode
15
-     // 12 channels at 26758 Hz samplerate
16
-    .byte  0x00, 0xCC, 0x98, 0x00
15
+     // 12 channels at 31536 Hz samplerate
16
+    .byte  0x00, 0xCC, 0x99, 0x00
17
 .org 0x081DC094
17
 .org 0x081DC094
18
     .word  0x03005F50+1 // new mixer RAM location (used for branch)
18
     .word  0x03005F50+1 // new mixer RAM location (used for branch)
19
 
19
 
71
 //.org 0x0800f268
71
 //.org 0x0800f268
72
 //    .halfword 0xE000
72
 //    .halfword 0xE000
73
 
73
 
74
+// disable help menu
75
+// see: https://www.pokecommunity.com/showthread.php?t=364909
76
+.org 0x0813B8C2
77
+    .halfword 0xE01D
78
+
79
+// decrease amount of valid file handles from 20 to 12 to free up some IRAM
80
+NUM_FILE_HANDLES equ 12
81
+.org 0x081E9948
82
+    cmp r1, #(NUM_FILE_HANDLES - 1)
83
+.org 0x081E99E4
84
+    add r0, #((NUM_FILE_HANDLES - 1) * 8)
85
+.org 0x081E9AA4
86
+    cmp r6, #NUM_FILE_HANDLES
87
+.org 0x081E9ADE
88
+    cmp r6, #NUM_FILE_HANDLES
89
+.org 0x081E9B1C
90
+    cmp r6, #NUM_FILE_HANDLES
91
+    bge 0x081E9B2E
92
+.org 0x081E9BA6
93
+    cmp r7, #NUM_FILE_HANDLES
94
+    bge 0x081E9BB8
95
+.org 0x081E9BDA
96
+    cmp r0, #NUM_FILE_HANDLES
97
+    blo 0x081E9BE2
98
+.org 0x081E9C84
99
+    cmp r1, #NUM_FILE_HANDLES
100
+    bge 0x081E9C94
101
+
74
 //flag routine
102
 //flag routine
75
 .org 0x0806E5D6
103
 .org 0x0806E5D6
76
 	ldr r0, =flag_hook|1
104
 	ldr r0, =flag_hook|1

+ 20
- 6
src/music/main_mixer.s View File

14
     .equ    GAME_KWJ6, 3
14
     .equ    GAME_KWJ6, 3
15
     .equ    GAME_AE7E, 4
15
     .equ    GAME_AE7E, 4
16
     .equ    GAME_BPRD, 5
16
     .equ    GAME_BPRD, 5
17
+    .equ    GAME_SOTS, 6
17
 
18
 
18
     /* SELECT USED GAME HERE */
19
     /* SELECT USED GAME HERE */
19
-    .equ    USED_GAME, GAME_BPRE
20
+    .equ    USED_GAME, GAME_SOTS
20
 
21
 
21
     .equ    FRAME_LENGTH_5734, 0x60
22
     .equ    FRAME_LENGTH_5734, 0x60
22
     .equ    FRAME_LENGTH_7884, 0x84             @ THIS MODE IS NOT SUPPORTED BY THIS ENGINE BECAUSE IT DOESN'T USE AN 8 ALIGNED BUFFER LENGTH
23
     .equ    FRAME_LENGTH_7884, 0x84             @ THIS MODE IS NOT SUPPORTED BY THIS ENGINE BECAUSE IT DOESN'T USE AN 8 ALIGNED BUFFER LENGTH
37
 
38
 
38
     .equ    BUFFER_IRAM_BPE, 0x03001AA8
39
     .equ    BUFFER_IRAM_BPE, 0x03001AA8
39
     .equ    BUFFER_IRAM_BPR, 0x030028E0
40
     .equ    BUFFER_IRAM_BPR, 0x030028E0
41
+    .equ    BUFFER_IRAM_SOTS, 0x030028A0
40
     .equ    BUFFER_IRAM_KWJ, 0x03005840
42
     .equ    BUFFER_IRAM_KWJ, 0x03005840
41
     .equ    BUFFER_IRAM_AE7, 0x03006D60
43
     .equ    BUFFER_IRAM_AE7, 0x03006D60
42
 
44
 
155
     .equ    ENABLE_DECOMPRESSION, 1
157
     .equ    ENABLE_DECOMPRESSION, 1
156
 
158
 
157
 .endif
159
 .endif
160
+@*********** IF POKEMON SOTS
161
+.if USED_GAME==GAME_SOTS
162
+
163
+    .equ    hq_buffer_ptr, BUFFER_IRAM_SOTS
164
+    .equ    decoder_buffer_target, DECODER_BUFFER_BPR
165
+    .equ    POKE_INIT, 1
166
+    .equ    DMA_FIX, 1
167
+    .equ    ENABLE_DECOMPRESSION, 1
168
+
169
+.endif
158
 @*********** IF KAWAs JUKEBOX 2006
170
 @*********** IF KAWAs JUKEBOX 2006
159
 .if USED_GAME==GAME_KWJ6
171
 .if USED_GAME==GAME_KWJ6
160
 
172
 
1359
  */
1371
  */
1360
 F_bdpcm_decoder:
1372
 F_bdpcm_decoder:
1361
 
1373
 
1362
-    STMFD   SP!, {R0, R2, R5-R7, LR}
1374
+    STMFD   SP!, {R0, LR}
1363
     MOV     R0, R3, LSR#6                       @ clip off everything but the block offset, each block is 0x40 samples long
1375
     MOV     R0, R3, LSR#6                       @ clip off everything but the block offset, each block is 0x40 samples long
1364
     LDR     R12, [R4, #CHN_BLOCK_COUNT]
1376
     LDR     R12, [R4, #CHN_BLOCK_COUNT]
1365
     CMP     R0, R12
1377
     CMP     R0, R12
1366
     BEQ     C_bdpcm_decoder_return              @ block already decoded -> skip
1378
     BEQ     C_bdpcm_decoder_return              @ block already decoded -> skip
1367
 
1379
 
1380
+    STMFD   SP!, {R2, R5-R7}
1368
     STR     R0, [R4, #CHN_BLOCK_COUNT]
1381
     STR     R0, [R4, #CHN_BLOCK_COUNT]
1369
     MOV     R12, #0x21                          @ 1 Block = 0x21 Bytes, 0x40 decoded samples
1382
     MOV     R12, #0x21                          @ 1 Block = 0x21 Bytes, 0x40 decoded samples
1370
     MUL     R2, R12, R0
1383
     MUL     R2, R12, R0
1393
         STRB    LR, [R5], #1
1406
         STRB    LR, [R5], #1
1394
         SUBS    R7, R7, #2
1407
         SUBS    R7, R7, #2
1395
         BGT     C_bdpcm_decoder_msb
1408
         BGT     C_bdpcm_decoder_msb
1396
-
1409
+    
1410
+    LDMFD   SP!, {R2, R5-R7}
1397
 C_bdpcm_decoder_return:
1411
 C_bdpcm_decoder_return:
1398
-    LDR     R5, decoder_buffer
1412
+    LDR     R12, decoder_buffer
1399
     AND     R0, R3, #0x3F
1413
     AND     R0, R3, #0x3F
1400
-    LDRSB   R12, [R5, R0]
1401
-    LDMFD   SP!, {R0, R2, R5-R7, PC}
1414
+    LDRSB   R12, [R12, R0]
1415
+    LDMFD   SP!, {R0, PC}
1402
 
1416
 
1403
     .align  2
1417
     .align  2
1404
 
1418