Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use standard bool everywhere #153

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions gc/gcbool.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
#pragma once

typedef unsigned int BOOL;
/*+----------------------------------------------------------------------------------------------+*/
// alias type typedefs
#define FIXED s32 ///< Alias type for sfp32
/*+----------------------------------------------------------------------------------------------+*/
#ifndef TRUE
#define TRUE 1 ///< True
#endif
/*+----------------------------------------------------------------------------------------------+*/
#ifndef FALSE
#define FALSE 0 ///< False
#endif
/*+----------------------------------------------------------------------------------------------+*/
#include <stdbool.h>

typedef bool BOOL __attribute__((deprecated));

__attribute__((deprecated)) static const bool FALSE = false;
__attribute__((deprecated)) static const bool TRUE = true;

8 changes: 4 additions & 4 deletions gc/gcmodplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ typedef struct _modsndbuf {

typedef struct _modplay {
MOD mod;
BOOL playing,paused;
BOOL bits,stereo,manual_polling;
bool playing,paused;
bool bits,stereo,manual_polling;
u32 playfreq,numSFXChans;
MODSNDBUF soundBuf;
} MODPlay;

void MODPlay_Init(MODPlay *mod);
s32 MODPlay_SetFrequency(MODPlay *mod,u32 freq);
void MODPlay_SetStereo(MODPlay *mod,BOOL stereo);
void MODPlay_SetStereo(MODPlay *mod,bool stereo);
s32 MODPlay_SetMOD(MODPlay *mod,const void *mem);
void MODPlay_Unload(MODPlay *mod);
s32 MODPlay_AllocSFXChannels(MODPlay *mod,u32 sfxchans);
s32 MODPlay_Start(MODPlay *mod);
s32 MODPlay_Stop(MODPlay *mod);
s32 MODPlay_TriggerNote(MODPlay *mod,u32 chan,u8 inst,u16 freq,u8 vol);
s32 MODPlay_Pause(MODPlay *mod,BOOL);
s32 MODPlay_Pause(MODPlay *mod,bool);
void MODPlay_SetVolume(MODPlay * mod, s32 musicvolume, s32 sfxvolume);

#ifdef __cplusplus
Expand Down
17 changes: 0 additions & 17 deletions gc/modplay/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,6 @@ typedef union
u32 adword;
} union_dword;





#ifndef BOOL
#define BOOL u32
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NULL
#define NULL 0
#endif

#ifdef __cplusplus
}
#endif
Expand Down
12 changes: 6 additions & 6 deletions gc/modplay/modplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ typedef struct _modinstr
u32 loop_start; /* 026..027 */
u32 loop_end; /* 028..029 */
u32 loop_length;
BOOL looped;
bool looped;
s8 * data;
} MOD_INSTR;

typedef struct _mod
{
BOOL loaded;
bool loaded;
s8 name[21];
MOD_INSTR instrument[31];
s32 num_patterns;
Expand All @@ -68,7 +68,7 @@ typedef struct _mod
s32 mixingbuflen;
s32 shiftval; /* Number of bits to lshift every mixed 16bit word by */
/* Player variables */
BOOL channel_active[MAX_VOICES];
bool channel_active[MAX_VOICES];
s32 patterndelay;
s32 speed;
s32 bpm;
Expand Down Expand Up @@ -100,7 +100,7 @@ typedef struct _mod
u8 trem_basevol[MAX_VOICES];
u8 trem_freq[MAX_VOICES];
u8 trem_depth[MAX_VOICES];
BOOL glissando[MAX_VOICES];
bool glissando[MAX_VOICES];
u8 trem_wave[MAX_VOICES];
u8 vib_wave[MAX_VOICES];

Expand All @@ -120,8 +120,8 @@ typedef struct _mod
u8 musicvolume;
u8 sfxvolume;

BOOL set;
BOOL *notify;
bool set;
bool *notify;

} MOD;

Expand Down
7 changes: 3 additions & 4 deletions gc/ogc/aram.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ distribution.
*/

#include <gctypes.h>
#include <gcbool.h>

/*!
* \addtogroup dmamode ARAM DMA transfer direction
Expand Down Expand Up @@ -206,10 +205,10 @@ void AR_Clear(u32 flag);
* \fn BOOL AR_CheckInit(void)
* \brief Get the ARAM subsystem initialization flag
*
* \return TRUE if the ARAM subsystem has been initialized(via AR_Init())<br>
* FALSE if the ARAM subsystem has not been initialized, or has been reset(via AR_Reset())
* \return true if the ARAM subsystem has been initialized(via AR_Init())<br>
* false if the ARAM subsystem has not been initialized, or has been reset(via AR_Reset())
*/
BOOL AR_CheckInit(void);
bool AR_CheckInit(void);


/*!
Expand Down
5 changes: 2 additions & 3 deletions gc/ogc/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ distribution.
*/

#include <gctypes.h>
#include <gcbool.h>

#define LC_BASEPREFIX 0xe000
#define LC_BASE (LC_BASEPREFIX<<16)
Expand Down Expand Up @@ -316,8 +315,8 @@ u32 LCQueueWait(u32);
void LCFlushQueue(void);
void LCAlloc(void *,u32);
void LCAllocNoInvalidate(void *,u32);
void LCAllocOneTag(BOOL,void *);
void LCAllocTags(BOOL,void *,u32);
void LCAllocOneTag(bool,void *);
void LCAllocTags(bool,void *,u32);

#define LCGetBase() ((void*)LC_BASE)
#ifdef __cplusplus
Expand Down
5 changes: 2 additions & 3 deletions gc/ogc/lwp.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ distribution.
*/

#include <gctypes.h>
#include <gcbool.h>

#define LWP_CLOSED -1
#define LWP_SUCCESSFUL 0
Expand Down Expand Up @@ -104,9 +103,9 @@ s32 LWP_ResumeThread(lwp_t thethread);
\brief Test whether the given thread is suspended or not
\param[in] thethread handle to the thread context which should be tested.

\return TRUE or FALSE
\return true or false
*/
BOOL LWP_ThreadIsSuspended(lwp_t thethread);
bool LWP_ThreadIsSuspended(lwp_t thethread);


/*! \fn lwp_t LWP_GetSelf(void)
Expand Down
3 changes: 1 addition & 2 deletions gc/ogc/lwp_heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define __LWP_HEAP_H__

#include <gctypes.h>
#include <gcbool.h>
#include "machine/asm.h"

#define HEAP_BLOCK_USED 1
Expand Down Expand Up @@ -46,7 +45,7 @@ typedef struct _heap_cntrl_st {

u32 __lwp_heap_init(heap_cntrl *theheap,void *start_addr,u32 size,u32 pg_size);
void* __lwp_heap_allocate(heap_cntrl *theheap,u32 size);
BOOL __lwp_heap_free(heap_cntrl *theheap,void *ptr);
bool __lwp_heap_free(heap_cntrl *theheap,void *ptr);
u32 __lwp_heap_getinfo(heap_cntrl *theheap,heap_iblock *theinfo);

#ifdef __cplusplus
Expand Down
1 change: 0 additions & 1 deletion gc/ogc/lwp_watchdog.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define __LWP_WATCHDOG_H__

#include <gctypes.h>
#include <gcbool.h>

#include "lwp_queue.h"
#include <time.h>
Expand Down
7 changes: 3 additions & 4 deletions gc/ogc/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ distribution.
*/

#include <gctypes.h>
#include <gcbool.h>

#define MQ_BOX_NULL 0xffffffff

Expand Down Expand Up @@ -93,7 +92,7 @@ void MQ_Close(mqbox_t mqbox);

\return bool result
*/
BOOL MQ_Send(mqbox_t mqbox,mqmsg_t msg,u32 flags);
bool MQ_Send(mqbox_t mqbox,mqmsg_t msg,u32 flags);


/*! \fn BOOL MQ_Jam(mqbox_t mqbox,mqmsg_t msg,u32 flags)
Expand All @@ -104,7 +103,7 @@ BOOL MQ_Send(mqbox_t mqbox,mqmsg_t msg,u32 flags);

\return bool result
*/
BOOL MQ_Jam(mqbox_t mqbox,mqmsg_t msg,u32 flags);
bool MQ_Jam(mqbox_t mqbox,mqmsg_t msg,u32 flags);


/*! \fn BOOL MQ_Receive(mqbox_t mqbox,mqmsg_t *msg,u32 flags)
Expand All @@ -115,7 +114,7 @@ BOOL MQ_Jam(mqbox_t mqbox,mqmsg_t msg,u32 flags);

\return bool result
*/
BOOL MQ_Receive(mqbox_t mqbox,mqmsg_t *msg,u32 flags);
bool MQ_Receive(mqbox_t mqbox,mqmsg_t *msg,u32 flags);

#ifdef __cplusplus
}
Expand Down
1 change: 0 additions & 1 deletion gc/ogc/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ distribution.
*/

#include <gctypes.h>
#include <gcbool.h>
#include <gcutil.h>
#include <time.h>
#include <ogc/lwp_queue.h>
Expand Down
2 changes: 1 addition & 1 deletion gc/samplerate.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ int src_set_ratio (SRC_STATE *state, double new_ratio) ;
int src_reset (SRC_STATE *state) ;

/*
** Return TRUE if ratio is a valid conversion ratio, FALSE
** Return true if ratio is a valid conversion ratio, false
** otherwise.
*/

Expand Down
40 changes: 20 additions & 20 deletions libmodplay/gcmodplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#define STACKSIZE 8192
#define SNDBUFFERSIZE (5760) //that's the maximum buffer size

static BOOL thr_running = FALSE;
static BOOL sndPlaying = FALSE;
static bool thr_running = false;
static bool sndPlaying = false;
static MODSNDBUF sndBuffer;

static u32 shiftVal = 0;
Expand Down Expand Up @@ -45,10 +45,10 @@ static void* player(void *arg)
u64 start;
#endif

thr_running = TRUE;
while(sndPlaying==TRUE) {
thr_running = true;
while(sndPlaying==true) {
LWP_ThreadSleep(player_queue);
if(sndPlaying==TRUE) {
if(sndPlaying==true) {
#ifdef _GCMOD_DEBUG
start = gettime();
#endif
Expand All @@ -58,7 +58,7 @@ static void* player(void *arg)
#endif
}
}
thr_running = FALSE;
thr_running = false;

return 0;
}
Expand Down Expand Up @@ -154,7 +154,7 @@ static s32 SndBufStart(MODSNDBUF *sndbuf)
while(thr_running);

curr_audio = 0;
sndPlaying = TRUE;
sndPlaying = true;
if(LWP_CreateThread(&hplayer,player,NULL,player_stack,STACKSIZE,80)!=-1) {
#ifndef __AESNDLIB_H__
AUDIO_RegisterDMACallback(dmaCallback);
Expand All @@ -165,7 +165,7 @@ static s32 SndBufStart(MODSNDBUF *sndbuf)
#endif
return 1;
}
sndPlaying = FALSE;
sndPlaying = false;

return -1;
}
Expand All @@ -180,14 +180,14 @@ static void SndBufStop()
AESND_SetVoiceStop(modvoice,true);
#endif
curr_audio = 0;
sndPlaying = FALSE;
sndPlaying = false;
LWP_ThreadSignal(player_queue);
LWP_JoinThread(hplayer,NULL);
}

static s32 updateWaveFormat(MODPlay *mod)
{
BOOL p = mod->playing;
bool p = mod->playing;

if(p)
SndBufStop();
Expand Down Expand Up @@ -236,17 +236,17 @@ void MODPlay_Init(MODPlay *mod)
}
#endif
MODPlay_SetFrequency(mod,48000);
MODPlay_SetStereo(mod,TRUE);
MODPlay_SetStereo(mod,true);

LWP_InitQueue(&player_queue);

sndPlaying = FALSE;
thr_running = FALSE;
sndPlaying = false;
thr_running = false;

mod->paused = FALSE;
mod->bits = TRUE;
mod->paused = false;
mod->bits = true;
mod->numSFXChans = 0;
mod->manual_polling = FALSE;
mod->manual_polling = false;
}

s32 MODPlay_SetFrequency(MODPlay *mod,u32 freq)
Expand All @@ -268,7 +268,7 @@ s32 MODPlay_SetFrequency(MODPlay *mod,u32 freq)
return -1;
}

void MODPlay_SetStereo(MODPlay *mod,BOOL stereo)
void MODPlay_SetStereo(MODPlay *mod,bool stereo)
{
if(stereo==mod->stereo) return;

Expand Down Expand Up @@ -301,7 +301,7 @@ s32 MODPlay_Start(MODPlay *mod)
updateWaveFormat(mod);
MOD_Start(&mod->mod);
if(SndBufStart(&mod->soundBuf)<0) return -1;
mod->playing = TRUE;
mod->playing = true;
return 0;
}

Expand All @@ -310,7 +310,7 @@ s32 MODPlay_Stop(MODPlay *mod)
if(!mod->playing) return -1;

SndBufStop();
mod->playing = FALSE;
mod->playing = false;
return 0;
}

Expand All @@ -325,7 +325,7 @@ s32 MODPlay_AllocSFXChannels(MODPlay *mod,u32 sfxchans)
return -1;
}

s32 MODPlay_Pause(MODPlay *mod,BOOL pause)
s32 MODPlay_Pause(MODPlay *mod,bool pause)
{
if(!mod->playing) return -1;
mod->paused = pause;
Expand Down
2 changes: 1 addition & 1 deletion libmodplay/mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
else \
{ \
playpos.adword = (mod->instrument[mod->instnum[voice]].loop_end-1)<<16; \
mod->channel_active[voice] = FALSE; \
mod->channel_active[voice] = false; \
break; \
} \
}
Expand Down
Loading