Skip to content

Commit

Permalink
Replace printf with LOG
Browse files Browse the repository at this point in the history
  • Loading branch information
rickgaiser committed Sep 8, 2019
1 parent 04cd087 commit 5ecdd86
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/httpclient.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include <stdio.h>
#include <string.h>
#include <kernel.h>
#include <sifrpc.h>

#include "httpclient.h"
#include "ioman.h"

static SifRpcClientData_t SifRpcClient;
static unsigned char RpcTxBuffer[256] ALIGNED(64);
Expand All @@ -12,7 +12,7 @@ static unsigned char RpcRxBuffer[64] ALIGNED(64);
int HttpInit(void)
{
while (SifBindRpc(&SifRpcClient, 0x00001B14, 0) < 0 || SifRpcClient.server == NULL) {
printf("libhttpclient: bind failed\n");
LOG("libhttpclient: bind failed\n");
nopdelay();
}

Expand Down
7 changes: 5 additions & 2 deletions src/ioman.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ static char tbuf[2048];

int ioPrintf(const char *format, ...)
{
WaitSema(gIOPrintfSemaId);
if (isIORunning == 1)
WaitSema(gIOPrintfSemaId);

va_list args;
va_start(args, format);
Expand All @@ -326,7 +327,9 @@ int ioPrintf(const char *format, ...)
#endif
va_end(args);

SignalSema(gIOPrintfSemaId);
if (isIORunning == 1)
SignalSema(gIOPrintfSemaId);

return ret;
}

Expand Down
4 changes: 2 additions & 2 deletions src/nbns.c
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#include <stdio.h>
#include <string.h>
#include <kernel.h>
#include <sifrpc.h>

#include "nbns.h"
#include "ioman.h"

static SifRpcClientData_t SifRpcClient;
static unsigned char RpcBuffer[64] ALIGNED(64);

int nbnsInit(void)
{
while (SifBindRpc(&SifRpcClient, 0x00001B13, 0) < 0 || SifRpcClient.server == NULL) {
printf("libnbns: bind failed\n");
LOG("libnbns: bind failed\n");
nopdelay();
}

Expand Down
5 changes: 3 additions & 2 deletions src/ps2cnf.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <string.h>

#include "ps2cnf.h"
#include "ioman.h"

#define CNF_LEN_MAX 1024

Expand Down Expand Up @@ -85,7 +86,7 @@ int ps2cnfGetBootFile(const char *path, char *bootfile)

if ((fd = fopen(path, "r")) == NULL)
{
printf("Can't open %s\n", path);
LOG("Can't open %s\n", path);
return ENOENT;
}

Expand All @@ -99,7 +100,7 @@ int ps2cnfGetBootFile(const char *path, char *bootfile)
if (fread(system_cnf, 1, size, fd) != size)
{
fclose(fd);
printf("Can't read %s\n", path);
LOG("Can't read %s\n", path);
return EIO;
}
fclose(fd);
Expand Down
15 changes: 9 additions & 6 deletions src/sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <audsrv.h>
#include "include/sound.h"
#include "include/opl.h"
#include "include/ioman.h"
#include "include/themes.h"

//default sfx
Expand Down Expand Up @@ -51,10 +52,12 @@ static int sfxRead(const char *full_path, struct sfxEffect *sfx)
void *buffer;
int ret, size;

LOG("sfxRead('%s')\n", full_path);

adpcm = fopen(full_path, "rb");
if (adpcm == NULL)
{
printf("Failed to open adpcm file %s\n", full_path);
LOG("Failed to open adpcm file %s\n", full_path);
return -ENOENT;
}

Expand All @@ -65,7 +68,7 @@ static int sfxRead(const char *full_path, struct sfxEffect *sfx)
buffer = memalign(64, size);
if (buffer == NULL)
{
printf("Failed to allocate memory for SFX\n");
LOG("Failed to allocate memory for SFX\n");
fclose(adpcm);
return -ENOMEM;
}
Expand All @@ -75,7 +78,7 @@ static int sfxRead(const char *full_path, struct sfxEffect *sfx)

if(ret != size)
{
printf("Failed to read SFX: %d (expected %d)\n", ret, size);
LOG("Failed to read SFX: %d (expected %d)\n", ret, size);
free(buffer);
return -EIO;
}
Expand Down Expand Up @@ -126,7 +129,7 @@ static int getFadeDelay(void)
bootSnd = fopen(boot_path, "rb");
if (bootSnd == NULL)
{
printf("Failed to open adpcm file %s\n", boot_path);
LOG("Failed to open adpcm file %s\n", boot_path);
return -ENOENT;
}

Expand Down Expand Up @@ -184,7 +187,7 @@ int sfxInit(int bootSnd)
ret = sfxRead(full_path, &sfx_files[i]);
if (ret != 0)
{
printf("SFX: %s could not be loaded. Using default sound %d.\n", full_path, ret);
LOG("SFX: %s could not be loaded. Using default sound %d.\n", full_path, ret);
}
}

Expand All @@ -195,7 +198,7 @@ int sfxInit(int bootSnd)
}
else
{
printf("SFX: failed to load %s, error %d\n", full_path, ret);
LOG("SFX: failed to load %s, error %d\n", full_path, ret);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ void sysLaunchLoaderElf(const char *filename, const char *mode_str, int size_cdv
//Get the kernel to use our EELOAD module and to begin erasure after module storage. EE core will erase any memory before the module storage (if any).
if(initKernel((void*)eh->entry, ModuleStorageEnd, &eeloadCopy, &initUserMemory) != 0)
{ //Should not happen, but...
printf("Error - kernel is unsupported.\n");
LOG("Error - kernel is unsupported.\n");
asm volatile("break\n");
}
sprintf(KernelConfig, "%u %u", (unsigned int)eeloadCopy, (unsigned int)initUserMemory);
Expand Down

0 comments on commit 5ecdd86

Please sign in to comment.