ソースを参照

disable help menu and increase audio samplerate to 31536 Hz

ipatix 7 年 前
コミット
c207d7e493
共有2 個のファイルを変更した50 個の追加8 個の削除を含む
  1. 30
    2
      patches/hooks.asm
  2. 20
    6
      src/music/main_mixer.s

+ 30
- 2
patches/hooks.asm ファイルの表示

@@ -12,8 +12,8 @@ _call_via_r1 equ 0x081E3BAC
12 12
     .word  0x0203E000   // new PCM work area
13 13
 .org 0x081DD0C8
14 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 17
 .org 0x081DC094
18 18
     .word  0x03005F50+1 // new mixer RAM location (used for branch)
19 19
 
@@ -71,6 +71,34 @@ _call_via_r1 equ 0x081E3BAC
71 71
 //.org 0x0800f268
72 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 102
 //flag routine
75 103
 .org 0x0806E5D6
76 104
 	ldr r0, =flag_hook|1

+ 20
- 6
src/music/main_mixer.s ファイルの表示

@@ -14,9 +14,10 @@
14 14
     .equ    GAME_KWJ6, 3
15 15
     .equ    GAME_AE7E, 4
16 16
     .equ    GAME_BPRD, 5
17
+    .equ    GAME_SOTS, 6
17 18
 
18 19
     /* SELECT USED GAME HERE */
19
-    .equ    USED_GAME, GAME_BPRE
20
+    .equ    USED_GAME, GAME_SOTS
20 21
 
21 22
     .equ    FRAME_LENGTH_5734, 0x60
22 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,6 +38,7 @@
37 38
 
38 39
     .equ    BUFFER_IRAM_BPE, 0x03001AA8
39 40
     .equ    BUFFER_IRAM_BPR, 0x030028E0
41
+    .equ    BUFFER_IRAM_SOTS, 0x030028A0
40 42
     .equ    BUFFER_IRAM_KWJ, 0x03005840
41 43
     .equ    BUFFER_IRAM_AE7, 0x03006D60
42 44
 
@@ -155,6 +157,16 @@
155 157
     .equ    ENABLE_DECOMPRESSION, 1
156 158
 
157 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 170
 @*********** IF KAWAs JUKEBOX 2006
159 171
 .if USED_GAME==GAME_KWJ6
160 172
 
@@ -1359,12 +1371,13 @@ C_uncompressed_reverse_mixing_load_skip:
1359 1371
  */
1360 1372
 F_bdpcm_decoder:
1361 1373
 
1362
-    STMFD   SP!, {R0, R2, R5-R7, LR}
1374
+    STMFD   SP!, {R0, LR}
1363 1375
     MOV     R0, R3, LSR#6                       @ clip off everything but the block offset, each block is 0x40 samples long
1364 1376
     LDR     R12, [R4, #CHN_BLOCK_COUNT]
1365 1377
     CMP     R0, R12
1366 1378
     BEQ     C_bdpcm_decoder_return              @ block already decoded -> skip
1367 1379
 
1380
+    STMFD   SP!, {R2, R5-R7}
1368 1381
     STR     R0, [R4, #CHN_BLOCK_COUNT]
1369 1382
     MOV     R12, #0x21                          @ 1 Block = 0x21 Bytes, 0x40 decoded samples
1370 1383
     MUL     R2, R12, R0
@@ -1393,12 +1406,13 @@ C_bdpcm_decoder_lsb:
1393 1406
         STRB    LR, [R5], #1
1394 1407
         SUBS    R7, R7, #2
1395 1408
         BGT     C_bdpcm_decoder_msb
1396
-
1409
+    
1410
+    LDMFD   SP!, {R2, R5-R7}
1397 1411
 C_bdpcm_decoder_return:
1398
-    LDR     R5, decoder_buffer
1412
+    LDR     R12, decoder_buffer
1399 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 1417
     .align  2
1404 1418