Skip to content

Commit

Permalink
- Fix Majoras Mask audio streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
emukidid committed Oct 8, 2016
1 parent 40f83b3 commit 0d4c1ae
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
17 changes: 9 additions & 8 deletions cube/swiss/source/patches/misc/MajoraAudioStream.S
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

#include "../asm.h"
#define _LANGUAGE_ASSEMBLY
#include "../../../../reservedarea.h"

.set AI_ADP_BUF, DECODED_BUFFER_0

.set UPDATE_STREAM, VAR_STREAM_UPDATE

.set audl, 10
.set audr, 9
.set oribuf, 5
Expand All @@ -41,7 +44,7 @@ check1:
cmplw cmpr, loc, tmp
beq cmpr, updateStream
check2:
slwi tmp, tmp, 1 #go to next buffer
slwi tmp, tmp, 1 #MAXBUF=0x1C00
cmplw cmpr, loc, tmp
beq cmpr, resetLoc
b checkInv
Expand All @@ -50,14 +53,12 @@ resetLoc:

updateStream:
li tmp, 1
stw tmp, VAR_STREAM_UPDATE(glob)
stb tmp, UPDATE_STREAM(glob)

checkInv:
lis buf, DECODE_WORK_AREA@h
li tmp, BUFSIZE
slwi tmp, tmp, 1
sub buf, buf, tmp
add buf, buf, loc
lis buf, AI_ADP_BUF@h
ori buf, buf, AI_ADP_BUF@l
add buf, loc, buf
rlwinm tmp, buf, 0,27,31
cmpwi cmpr, tmp, 0
bne cmpr, insertL
Expand Down
4 changes: 3 additions & 1 deletion cube/swiss/source/patches/misc/MajoraLoadRegs.S
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define _LANGUAGE_ASSEMBLY
#include "../../../../reservedarea.h"

.set AI_ADP_LOC, VAR_STREAM_BUFLOC

.set tmp, 28
.set buf, 27
.set loc, 26
Expand All @@ -31,7 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.globl MajoraLoadRegs
MajoraLoadRegs:
beq cmpstrm,end
stw loc, VAR_STREAM_BUFLOC(glob)
stw loc, AI_ADP_LOC(glob)
end:
lwz %r27, 0xC(%r1)
lwz %r26, 0x8(%r1)
Expand Down
7 changes: 5 additions & 2 deletions cube/swiss/source/patches/misc/MajoraSaveRegs.S
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define _LANGUAGE_ASSEMBLY
#include "../../../../reservedarea.h"

.set STREAMING, VAR_STREAM_DI
.set AI_ADP_LOC, VAR_STREAM_BUFLOC

.set tmp, 28
.set buf, 27
.set loc, 26
Expand All @@ -35,10 +38,10 @@ MajoraSaveRegs:
stw loc, 0x8(%r1)
stw tmp, 0x4(%r1)
lis glob, VAR_AREA
lwz tmp, VAR_STREAM_DI(glob)
lbz tmp, STREAMING(glob)
cmpwi cmpstrm,tmp, 0
beq cmpstrm,end
lwz loc, VAR_STREAM_BUFLOC(glob)
lwz loc, AI_ADP_LOC(glob)
end:
nop #b ori

Expand Down

0 comments on commit 0d4c1ae

Please sign in to comment.