Skip to content

Commit

Permalink
Merge pull request #13 from pcercuei/lightrec
Browse files Browse the repository at this point in the history
Some fixes
  • Loading branch information
emukidid committed Mar 20, 2023
2 parents 59d9005 + 5117d72 commit 7261a1e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
13 changes: 13 additions & 0 deletions Gamecube/DEBUG.c
Expand Up @@ -6,6 +6,7 @@
#include <string.h>
#include <stdio.h>
#include <fat.h>
#include <stdarg.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/dir.h>
Expand Down Expand Up @@ -36,6 +37,18 @@ static void check_heap_space(void){
}
#endif

void lightrec_fprintf(FILE *f, const char *format, ...)
{
#ifdef SHOW_DEBUG
va_list args;
va_start(args, format);
vsprintf(txtbuffer, format, args);
va_end(args);

DEBUG_print(txtbuffer,DBG_CORE1);
#endif
}

void DEBUG_update() {
#ifdef SHOW_DEBUG
int i;
Expand Down
2 changes: 1 addition & 1 deletion dfsound/aesnd.c
Expand Up @@ -21,7 +21,7 @@
#include <string.h>
#include "out.h"
#include "spu_config.h"
#include "../GameCube/wiisxConfig.h"
#include "../Gamecube/wiiSXconfig.h"

char audioEnabled;
static AESNDPB* voice = NULL;
Expand Down
12 changes: 10 additions & 2 deletions dfsound/registers.c
Expand Up @@ -23,6 +23,14 @@
#include "registers.h"
#include "spu_config.h"

#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define HTOLE16(x) __builtin_bswap16(x)
#define LE16TOH(x) __builtin_bswap16(x)
#else
#define HTOLE16(x) (x)
#define LE16TOH(x) (x)
#endif

static void SoundOn(int start,int end,unsigned short val);
static void SoundOff(int start,int end,unsigned short val);
static void FModOn(int start,int end,unsigned short val);
Expand Down Expand Up @@ -127,7 +135,7 @@ void CALLBACK DFS_SPUwriteRegister(unsigned long reg, unsigned short val,
break;
//-------------------------------------------------//
case H_SPUdata:
*(unsigned short *)(spu.spuMemC + spu.spuAddr) = val;
*(unsigned short *)(spu.spuMemC + spu.spuAddr) = HTOLE16(val);
spu.spuAddr += 2;
spu.spuAddr &= 0x7fffe;
break;
Expand Down Expand Up @@ -334,7 +342,7 @@ unsigned short CALLBACK DFS_SPUreadRegister(unsigned long reg)

case H_SPUdata:
{
unsigned short s = *(unsigned short *)(spu.spuMemC + spu.spuAddr);
unsigned short s = LE16TOH(*(unsigned short *)(spu.spuMemC + spu.spuAddr));
spu.spuAddr += 2;
spu.spuAddr &= 0x7fffe;
return s;
Expand Down

0 comments on commit 7261a1e

Please sign in to comment.