diff --git a/gc/gcbool.h b/gc/gcbool.h index 61b0a90b6..893f85c3a 100644 --- a/gc/gcbool.h +++ b/gc/gcbool.h @@ -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 + +typedef bool BOOL __attribute__((deprecated)); + +__attribute__((deprecated)) static const bool FALSE = false; +__attribute__((deprecated)) static const bool TRUE = true; diff --git a/gc/gcmodplay.h b/gc/gcmodplay.h index a59d07753..fd7a3ff83 100644 --- a/gc/gcmodplay.h +++ b/gc/gcmodplay.h @@ -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 diff --git a/gc/modplay/defines.h b/gc/modplay/defines.h index 34f5d5778..5a432f398 100644 --- a/gc/modplay/defines.h +++ b/gc/modplay/defines.h @@ -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 diff --git a/gc/modplay/modplay.h b/gc/modplay/modplay.h index 1f957ac70..a330a5bbf 100644 --- a/gc/modplay/modplay.h +++ b/gc/modplay/modplay.h @@ -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; @@ -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; @@ -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]; @@ -120,8 +120,8 @@ typedef struct _mod u8 musicvolume; u8 sfxvolume; - BOOL set; - BOOL *notify; + bool set; + bool *notify; } MOD; diff --git a/gc/ogc/aram.h b/gc/ogc/aram.h index b12e9b588..999081f57 100644 --- a/gc/ogc/aram.h +++ b/gc/ogc/aram.h @@ -38,7 +38,6 @@ distribution. */ #include -#include /*! * \addtogroup dmamode ARAM DMA transfer direction @@ -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())
- * 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())
+ * false if the ARAM subsystem has not been initialized, or has been reset(via AR_Reset()) */ -BOOL AR_CheckInit(void); +bool AR_CheckInit(void); /*! diff --git a/gc/ogc/cache.h b/gc/ogc/cache.h index 8021c3a41..0a1e6213a 100644 --- a/gc/ogc/cache.h +++ b/gc/ogc/cache.h @@ -39,7 +39,6 @@ distribution. */ #include -#include #define LC_BASEPREFIX 0xe000 #define LC_BASE (LC_BASEPREFIX<<16) @@ -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 diff --git a/gc/ogc/lwp.h b/gc/ogc/lwp.h index ff47d4483..549ef2374 100644 --- a/gc/ogc/lwp.h +++ b/gc/ogc/lwp.h @@ -39,7 +39,6 @@ distribution. */ #include -#include #define LWP_CLOSED -1 #define LWP_SUCCESSFUL 0 @@ -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) diff --git a/gc/ogc/lwp_heap.h b/gc/ogc/lwp_heap.h index f26f1476a..794288b4a 100644 --- a/gc/ogc/lwp_heap.h +++ b/gc/ogc/lwp_heap.h @@ -2,7 +2,6 @@ #define __LWP_HEAP_H__ #include -#include #include "machine/asm.h" #define HEAP_BLOCK_USED 1 @@ -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 diff --git a/gc/ogc/lwp_watchdog.h b/gc/ogc/lwp_watchdog.h index 9801cca4c..f64e47595 100644 --- a/gc/ogc/lwp_watchdog.h +++ b/gc/ogc/lwp_watchdog.h @@ -2,7 +2,6 @@ #define __LWP_WATCHDOG_H__ #include -#include #include "lwp_queue.h" #include diff --git a/gc/ogc/message.h b/gc/ogc/message.h index 34fe2f48b..aa0c0bf8f 100644 --- a/gc/ogc/message.h +++ b/gc/ogc/message.h @@ -37,7 +37,6 @@ distribution. */ #include -#include #define MQ_BOX_NULL 0xffffffff @@ -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) @@ -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) @@ -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 } diff --git a/gc/ogc/system.h b/gc/ogc/system.h index 5493ed8a6..ce0c77194 100644 --- a/gc/ogc/system.h +++ b/gc/ogc/system.h @@ -39,7 +39,6 @@ distribution. */ #include -#include #include #include #include diff --git a/gc/samplerate.h b/gc/samplerate.h index 9232dc29d..ee38060ca 100644 --- a/gc/samplerate.h +++ b/gc/samplerate.h @@ -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. */ diff --git a/libmodplay/gcmodplay.c b/libmodplay/gcmodplay.c index 831aadd56..6c1a706f0 100644 --- a/libmodplay/gcmodplay.c +++ b/libmodplay/gcmodplay.c @@ -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; @@ -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 @@ -58,7 +58,7 @@ static void* player(void *arg) #endif } } - thr_running = FALSE; + thr_running = false; return 0; } @@ -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); @@ -165,7 +165,7 @@ static s32 SndBufStart(MODSNDBUF *sndbuf) #endif return 1; } - sndPlaying = FALSE; + sndPlaying = false; return -1; } @@ -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(); @@ -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) @@ -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; @@ -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; } @@ -310,7 +310,7 @@ s32 MODPlay_Stop(MODPlay *mod) if(!mod->playing) return -1; SndBufStop(); - mod->playing = FALSE; + mod->playing = false; return 0; } @@ -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; diff --git a/libmodplay/mixer.c b/libmodplay/mixer.c index 6fefdfafc..d6e2b3590 100644 --- a/libmodplay/mixer.c +++ b/libmodplay/mixer.c @@ -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; \ } \ } diff --git a/libmodplay/modplay.c b/libmodplay/modplay.c index e7f020f89..748a33701 100644 --- a/libmodplay/modplay.c +++ b/libmodplay/modplay.c @@ -260,12 +260,12 @@ void MOD_Free ( MOD * mod ) MEM_SET ( mod, 0, sizeof(MOD) ); - mod->loaded = FALSE; + mod->loaded = false; } #else void MOD_Free ( MOD * mod ) { - mod->set = FALSE; + mod->set = false; if (!mod->loaded) return; @@ -275,7 +275,7 @@ void MOD_Free ( MOD * mod ) MEM_SET ( mod, 0, sizeof(MOD) ); - mod->loaded = FALSE; + mod->loaded = false; } #endif @@ -380,10 +380,10 @@ s32 MOD_SetMOD ( MOD * mod, u8 * mem ) mod->instrument[i].loop_end = tmp + mod->instrument[i].loop_start; /* Is the sample looped ? */ - mod->instrument[i].looped = TRUE; + mod->instrument[i].looped = true; if (tmp<=2) { /* No ! */ - mod->instrument[i].looped = FALSE; + mod->instrument[i].looped = false; mod->instrument[i].loop_start = mod->instrument[i].loop_end = mod->instrument[i].length; } @@ -422,7 +422,7 @@ s32 MOD_SetMOD ( MOD * mod, u8 * mem ) } } - mod->set = TRUE; + mod->set = true; return 0; } @@ -490,7 +490,7 @@ s32 MOD_Load ( MOD * mod, const char * fname ) MOD_Free ( mod ); return -1; } - mod->loaded = TRUE; + mod->loaded = true; return 0; } @@ -524,19 +524,19 @@ u8 getEffectOp ( MOD * mod, s32 patternline, s32 channel ) return (data[3]); } -BOOL triggerNote ( MOD * mod, s32 i, u8 instrument, u16 note, u8 effect ) +bool triggerNote ( MOD * mod, s32 i, u8 instrument, u16 note, u8 effect ) { - BOOL ret = FALSE; + bool ret = false; if ((instrument!=0) && (note!=0) && (effect!=3) && (effect!=5)) { mod->playpos[i] = 0; mod->instnum[i] = instrument-1; mod->sintabpos[i] = 0; - ret = TRUE; + ret = true; } if (note!=0) { - ret = TRUE; + ret = true; mod->channote[i] = note; if ((effect==3) || (effect==5)) mod->portamento_to[i] = note; @@ -550,7 +550,7 @@ BOOL triggerNote ( MOD * mod, s32 i, u8 instrument, u16 note, u8 effect ) } if (instrument != 0) { - ret = TRUE; + ret = true; mod->volume[i] = mod->instrument[mod->instnum[i]].volume; } return ret; @@ -745,7 +745,7 @@ u32 effect_handler ( MOD * mod ) { mod->retrigger_counter[i] = 0; mod->playpos[i] = 0; - mod->channel_active[i] = TRUE; + mod->channel_active[i] = true; retval |= 1<speedcounter == (mod->effectop[i]&0x0f)) { triggerNote ( mod, i, mod->nextinstr[i], mod->nextnote[i], mod->effect[i] ); - mod->channel_active[i] = TRUE; + mod->channel_active[i] = true; retval |= 1<patternline, 0 ); for (i=0;inum_voices;++i) @@ -816,7 +816,7 @@ u32 process ( MOD * mod ) if (triggerNote ( mod, i, mod->nextinstr[i], mod->nextnote[i], effect )) { retval |= 1<channel_active[i] = TRUE; + mod->channel_active[i] = true; } } @@ -877,7 +877,7 @@ u32 process ( MOD * mod ) case 0x0b: if (effect_operand<128) { - if(mod->notify) *mod->notify = TRUE; + if(mod->notify) *mod->notify = true; mod->songpos = effect_operand; mod->patternline = 0; return retval; @@ -889,7 +889,7 @@ u32 process ( MOD * mod ) mod->volume[i] = effect_operand; break; case 0x0d: - doPatternBreak=TRUE; + doPatternBreak=true; break; case 0x0e: switch ( (effect_operand>>4)&0x0f ) @@ -906,10 +906,10 @@ u32 process ( MOD * mod ) break; case 0x03: if ( (effect_operand&0x0f) == 0x00 ) - mod->glissando[i] = FALSE; + mod->glissando[i] = false; else if ( (effect_operand&0x0f) == 0x01 ) - mod->glissando[i] = TRUE; + mod->glissando[i] = true; break; case 0x04: if ( (effect_operand&0x0f) < 8 ) @@ -923,14 +923,14 @@ u32 process ( MOD * mod ) mod->patternline_jumpto = mod->patternline; else { - doPatternLoop = TRUE; + doPatternLoop = true; if (mod->patternline_jumpcount==0) { mod->patternline_jumpcount = effect_operand&0x0f; } else { if (--mod->patternline_jumpcount==0) - doPatternLoop = FALSE; + doPatternLoop = false; } } break; @@ -986,7 +986,7 @@ u32 process ( MOD * mod ) mod->patternline = 0; if (mod->songpos>=mod->song_length) { - if(mod->notify) *mod->notify = TRUE; + if(mod->notify) *mod->notify = true; mod->songpos = 0; mod->patternline = 0; } @@ -1008,7 +1008,7 @@ u32 process ( MOD * mod ) } if (mod->songpos>=mod->song_length) { - if(mod->notify) *mod->notify = TRUE; + if(mod->notify) *mod->notify = true; mod->songpos = 0; mod->patternline = 0; } @@ -1032,10 +1032,10 @@ void MOD_Start ( MOD * mod ) mod->vib_freq[i] = 0; mod->vib_depth[i] = 0; mod->last_effect[i] = 0; - mod->glissando[i] = FALSE; + mod->glissando[i] = false; mod->trem_wave[i] = 0; mod->vib_wave[i] = 0; - mod->channel_active[i] = FALSE; + mod->channel_active[i] = false; } mod->songpos = 0; @@ -1167,7 +1167,7 @@ s32 MOD_TriggerNote ( MOD * mod, s32 channel, u8 instnum, u16 freq, u8 vol ) if (instnum!=0xff) { - mod->channel_active[channel] = TRUE; + mod->channel_active[channel] = true; mod->playpos[channel] = 0; mod->instnum[channel] = instnum; } diff --git a/libogc/aram.c b/libogc/aram.c index 2641f3113..61365d759 100644 --- a/libogc/aram.c +++ b/libogc/aram.c @@ -199,7 +199,7 @@ void AR_Clear(u32 flag) } } -BOOL AR_CheckInit(void) +bool AR_CheckInit(void) { return __ARInit_Flag; } diff --git a/libogc/arqmgr.c b/libogc/arqmgr.c index d72fbe351..f701f56ff 100644 --- a/libogc/arqmgr.c +++ b/libogc/arqmgr.c @@ -49,7 +49,7 @@ typedef struct _arqm_info { u32 aram_start; u32 curr_read_offset; u32 curr_aram_offset; - volatile BOOL polled; + volatile bool polled; } ARQM_Info; static u32 __ARQMStackLocation; @@ -70,7 +70,7 @@ static void __ARQMPollCallback(ARQRequest *req) if(i>=ARQM_STACKENTRIES) return; ptr->callback = NULL; - ptr->polled = TRUE; + ptr->polled = true; } void ARQM_Init(u32 arambase,s32 len) @@ -100,7 +100,7 @@ u32 ARQM_PushData(void *buffer,s32 len) ptr = &__ARQMInfo[__ARQMStackLocation]; _CPU_ISR_Disable(level); - ptr->polled = FALSE; + ptr->polled = false; ptr->aram_start = __ARQMStackPointer[__ARQMStackLocation++]; __ARQMStackPointer[__ARQMStackLocation] = ptr->aram_start+rlen; __ARQMFreeBytes -= rlen; @@ -108,7 +108,7 @@ u32 ARQM_PushData(void *buffer,s32 len) ARQ_PostRequestAsync(&ptr->arqhandle,__ARQMStackLocation-1,ARQ_MRAMTOARAM,ARQ_PRIO_HI,ptr->aram_start,(u32)buffer,rlen,__ARQMPollCallback); _CPU_ISR_Restore(level); - while(ptr->polled==FALSE); + while(ptr->polled==false); return (ptr->aram_start); } return 0; diff --git a/libogc/cache.c b/libogc/cache.c index 88f5e0cf2..d5697cd8f 100644 --- a/libogc/cache.c +++ b/libogc/cache.c @@ -121,7 +121,7 @@ void LCAlloc(void *addr,u32 bytes) __LCEnable(); _CPU_ISR_Restore(level); } - LCAllocTags(TRUE,addr,cnt); + LCAllocTags(true,addr,cnt); } void LCAllocNoInvalidate(void *addr,u32 bytes) @@ -135,7 +135,7 @@ void LCAllocNoInvalidate(void *addr,u32 bytes) __LCEnable(); _CPU_ISR_Restore(level); } - LCAllocTags(FALSE,addr,cnt); + LCAllocTags(true,addr,cnt); } #ifdef HW_RVL void L2Enhance(void) diff --git a/libogc/card.c b/libogc/card.c index 7608f1dd5..a5cd793bd 100644 --- a/libogc/card.c +++ b/libogc/card.c @@ -241,9 +241,9 @@ static vu16* const _viReg = (u16*)0xCC002000; /* new api */ static s32 __card_onreset(s32 final) { - if(final==FALSE) { - if(CARD_Unmount(CARD_SLOTA)==CARD_ERROR_BUSY) return 0; - if(CARD_Unmount(CARD_SLOTB)==CARD_ERROR_BUSY) return 0; + if(final==false) { + if(CARD_Unmount(CARD_SLOTA)==-1) return 0; + if(CARD_Unmount(CARD_SLOTB)==-1) return 0; } return 1; } diff --git a/libogc/cond.c b/libogc/cond.c index 5d73c5c0f..68fea04b3 100644 --- a/libogc/cond.c +++ b/libogc/cond.c @@ -168,23 +168,23 @@ s32 LWP_CondInit(cond_t *cond) s32 LWP_CondWait(cond_t cond,mutex_t mutex) { - return __lwp_cond_waitsupp(cond,mutex,LWP_THREADQ_NOTIMEOUT,FALSE); + return __lwp_cond_waitsupp(cond,mutex,LWP_THREADQ_NOTIMEOUT,false); } s32 LWP_CondSignal(cond_t cond) { - return __lwp_cond_signalsupp(cond,FALSE); + return __lwp_cond_signalsupp(cond,false); } s32 LWP_CondBroadcast(cond_t cond) { - return __lwp_cond_signalsupp(cond,TRUE); + return __lwp_cond_signalsupp(cond,true); } s32 LWP_CondTimedWait(cond_t cond,mutex_t mutex,const struct timespec *abstime) { u64 timeout = LWP_THREADQ_NOTIMEOUT; - bool timedout = FALSE; + bool timedout = false; if(abstime) timeout = __lwp_wd_calc_ticks(abstime); return __lwp_cond_waitsupp(cond,mutex,timeout,timedout); diff --git a/libogc/dsp.c b/libogc/dsp.c index 7fa6be522..9b93b023b 100644 --- a/libogc/dsp.c +++ b/libogc/dsp.c @@ -32,7 +32,6 @@ distribution. #include #include #include "gcutil.h" -#include #include "asm.h" #include "processor.h" #include "irq.h" @@ -54,8 +53,8 @@ distribution. #define DSPCR_RES 0x0001 // reset DSP -static u32 __dsp_inited = FALSE; -static u32 __dsp_rudetask_pend = FALSE; +static u32 __dsp_inited = false; +static u32 __dsp_rudetask_pend = false; static DSPCallback __dsp_intcb = NULL; static dsptask_t *__dsp_currtask,*__dsp_lasttask,*__dsp_firsttask,*__dsp_rudetask,*tmp_task; @@ -235,13 +234,13 @@ static void __dsp_def_taskcb(void) if(__dsp_currtask->res_cb) __dsp_currtask->res_cb(__dsp_currtask); break; case 0xDCD10002: - if(__dsp_rudetask_pend==TRUE) { + if(__dsp_rudetask_pend==true) { if(__dsp_rudetask==__dsp_currtask) { DSP_SendMailTo(0xCDD10003); while(DSP_CheckMailTo()); __dsp_rudetask = NULL; - __dsp_rudetask_pend = FALSE; + __dsp_rudetask_pend = false; if(__dsp_currtask->res_cb) __dsp_currtask->res_cb(__dsp_currtask); } else { DSP_SendMailTo(0xCDD10001); @@ -251,7 +250,7 @@ static void __dsp_def_taskcb(void) __dsp_currtask->state = DSPTASK_YIELD; __dsp_currtask = __dsp_rudetask; __dsp_rudetask = NULL; - __dsp_rudetask_pend = FALSE; + __dsp_rudetask_pend = false; } } else if(__dsp_currtask->next==NULL) { if(__dsp_firsttask==__dsp_currtask) { @@ -277,7 +276,7 @@ static void __dsp_def_taskcb(void) } break; case 0xDCD10003: - if(__dsp_rudetask_pend==TRUE) { + if(__dsp_rudetask_pend==true) { if(__dsp_currtask->done_cb) __dsp_currtask->done_cb(__dsp_currtask); DSP_SendMailTo(0xCDD10001); while(DSP_CheckMailTo()); @@ -286,7 +285,7 @@ static void __dsp_def_taskcb(void) __dsp_removetask(__dsp_currtask); __dsp_currtask = __dsp_rudetask; - __dsp_rudetask_pend = FALSE; + __dsp_rudetask_pend = false; __dsp_rudetask = NULL; } else if(__dsp_currtask->next==NULL) { if(__dsp_firsttask==__dsp_currtask) { @@ -329,7 +328,7 @@ void DSP_Init(void) printf("DSP_Init()\n"); #endif _CPU_ISR_Disable(level); - if(__dsp_inited==FALSE) { + if(__dsp_inited==false) { __dsp_intcb= __dsp_def_taskcb; IRQ_Request(IRQ_DSP_DSP,__dsp_inthandler,NULL); @@ -342,7 +341,7 @@ void DSP_Init(void) __dsp_firsttask = NULL; __dsp_lasttask = NULL; tmp_task = NULL; - __dsp_inited = TRUE; + __dsp_inited = true; } _CPU_ISR_Restore(level); } @@ -493,12 +492,12 @@ dsptask_t* DSP_AssertTask(dsptask_t *task) _CPU_ISR_Disable(level); if(task==__dsp_currtask) { __dsp_rudetask = task; - __dsp_rudetask_pend = TRUE; + __dsp_rudetask_pend = true; ret = task; } else { if(task->prio<__dsp_currtask->prio) { __dsp_rudetask = task; - __dsp_rudetask_pend = TRUE; + __dsp_rudetask_pend = true; if(__dsp_currtask->state==DSPTASK_RUN) _dspReg[5] = ((_dspReg[5]&~(DSPCR_DSPINT|DSPCR_ARINT|DSPCR_AIINT))|DSPCR_PIINT); diff --git a/libogc/dvd.c b/libogc/dvd.c index 55a4035ce..7ed07f96d 100644 --- a/libogc/dvd.c +++ b/libogc/dvd.c @@ -170,7 +170,7 @@ static u32 __dvd_autoinvalidation = 1; static u32 __dvd_cancellasterror = 0; static u32 __dvd_drivechecked = 0; static u32 __dvd_drivestate = 0; -static u32 __dvd_extensionsenabled = TRUE; +static u32 __dvd_extensionsenabled = true; static u32 __dvd_lastlen; static u32 __dvd_nextcmdnum; static u32 __dvd_workaround; @@ -766,7 +766,7 @@ static void __dvd_stategettingerrorcb(s32 result) // disable the extensions iff they're enabled and we were trying to read the disc ID if(__dvd_executing->cmd==0x05) { __dvd_lasterror = 0; - __dvd_extensionsenabled = FALSE; + __dvd_extensionsenabled = false; DVD_LowSpinUpDrive(__dvd_stateretrycb); return; } @@ -1549,7 +1549,7 @@ static void __dvd_statebusy(dvdcmdblk *block) return; case 16: __dvd_lasterror = 0; - __dvd_extensionsenabled = TRUE; + __dvd_extensionsenabled = true; DVD_LowSpinUpDrive(__dvd_statebusycb); return; case 17: @@ -1647,7 +1647,7 @@ static void __dvd_statecoverclosed(void) if(blk->cb) blk->cb(-4,blk); __dvd_stateready(); } else { - __dvd_extensionsenabled = TRUE; + __dvd_extensionsenabled = true; DVD_LowSpinUpDrive(__dvd_statecoverclosed_spinupcb); } } diff --git a/libogc/exception.c b/libogc/exception.c index 74ff07e5b..b935f0363 100644 --- a/libogc/exception.c +++ b/libogc/exception.c @@ -222,7 +222,7 @@ static void waitForReload(void) { kprintf("\n\tReset\n\n\n"); #if defined(HW_DOL) - SYS_ResetSystem(SYS_HOTRESET,0,FALSE); + SYS_ResetSystem(SYS_HOTRESET,0,false); #else __reload (); #endif diff --git a/libogc/gx.c b/libogc/gx.c index 5fb016f9d..5fb9c102a 100644 --- a/libogc/gx.c +++ b/libogc/gx.c @@ -145,7 +145,7 @@ static sys_resetinfo __gx_resetinfo = { extern int printk(const char *fmt,...); #endif -static __inline__ BOOL IsWriteGatherBufferEmpty(void) +static __inline__ bool IsWriteGatherBufferEmpty(void) { return !(mfwpar()&1); } @@ -199,7 +199,7 @@ static __inline__ void __GX_FifoReadDisable(void) static s32 __gx_onreset(s32 final) { - if(final==FALSE) { + if(!final) { GX_Flush(); GX_AbortFrame(); } @@ -347,7 +347,7 @@ static void __GX_CleanGPFifo(void) _CPU_ISR_Disable(level); __GX_FifoReadDisable(); - __GX_WriteFifoIntEnable(FALSE,FALSE); + __GX_WriteFifoIntEnable(GX_FALSE,GX_FALSE); gpfifo->rd_ptr = gpfifo->wt_ptr; gpfifo->rdwt_dst = 0; @@ -371,14 +371,14 @@ static void __GX_CleanGPFifo(void) cpufifo->rdwt_dst = gpfifo->rdwt_dst; _piReg[5] = (cpufifo->wt_ptr&0x1FFFFFE0); - __GX_WriteFifoIntEnable(TRUE,FALSE); - __GX_FifoLink(TRUE); + __GX_WriteFifoIntEnable(GX_TRUE,GX_FALSE); + __GX_FifoLink(GX_TRUE); } __gx->cpCRreg &= ~0x22; _cpReg[1] = __gx->cpCRreg; breakPtCB = NULL; - __GX_WriteFifoIntReset(TRUE,TRUE); + __GX_WriteFifoIntReset(GX_TRUE,GX_TRUE); __GX_FifoReadEnable(); _CPU_ISR_Restore(level); } diff --git a/libogc/lock_supp.c b/libogc/lock_supp.c index d7c6c8277..ba379ad64 100644 --- a/libogc/lock_supp.c +++ b/libogc/lock_supp.c @@ -11,63 +11,53 @@ #include "asm.h" #include "processor.h" #include "mutex.h" -#include -static void __libogc_lock_init(_LOCK_T *lock,int recursive) +void __syscall_lock_init(_LOCK_T *lock) { s32 ret; mutex_t retlck = LWP_MUTEX_NULL; - if(!lock) return; *lock = 0; - ret = LWP_MutexInit(&retlck,(recursive?TRUE:FALSE)); + ret = LWP_MutexInit(&retlck,false); if(ret==0) *lock = (_LOCK_T)retlck; - } -void __syscall_lock_init(_LOCK_T *lock) +void __syscall_lock_init_recursive(_LOCK_RECURSIVE_T *lock) { - __libogc_lock_init(lock,0); -} + s32 ret; + mutex_t retlck = LWP_MUTEX_NULL; + if(!lock) return; -void __syscall_lock_init_recursive(_LOCK_T *lock) -{ - __libogc_lock_init(lock,1); + *lock = 0; + ret = LWP_MutexInit(&retlck,true); + if(ret==0) *lock = (_LOCK_T)retlck; } void __syscall_lock_close(_LOCK_T *lock) { s32 ret; - mutex_t plock; if(!lock || *lock==0) return; - plock = (mutex_t)*lock; - ret = LWP_MutexDestroy(plock); + ret = LWP_MutexDestroy((mutex_t)*lock); if(ret==0) *lock = 0; } void __syscall_lock_acquire(_LOCK_T *lock) { - mutex_t plock; - if(!lock || *lock==0) return; - plock = (mutex_t)*lock; - LWP_MutexLock(plock); + LWP_MutexLock((mutex_t)*lock); } -void __syscall_lock_release(int *lock) +void __syscall_lock_release(_LOCK_T *lock) { - mutex_t plock; - if(!lock || *lock==0) return; - plock = (mutex_t)*lock; - LWP_MutexUnlock(plock); + LWP_MutexUnlock((mutex_t)*lock); } diff --git a/libogc/lwp.c b/libogc/lwp.c index df190eec6..9c015e6c1 100644 --- a/libogc/lwp.c +++ b/libogc/lwp.c @@ -141,7 +141,7 @@ void __lwp_sysinit(void) // create idle thread, is needed iff all threads are locked on a queue _thr_idle = (lwp_cntrl*)__lwp_objmgr_allocate(&_lwp_thr_objects); - __lwp_thread_init(_thr_idle,NULL,0,255,0,TRUE); + __lwp_thread_init(_thr_idle,NULL,0,255,0,true); _thr_executing = _thr_heir = _thr_idle; __lwp_thread_start(_thr_idle,idle_func,NULL); __lwp_objmgr_open(&_lwp_thr_objects,&_thr_idle->object); @@ -149,24 +149,24 @@ void __lwp_sysinit(void) // create main thread, as this is our entry point // for every GC application. _thr_main = (lwp_cntrl*)__lwp_objmgr_allocate(&_lwp_thr_objects); - __lwp_thread_init(_thr_main,__stack_end,((u32)__stack_addr-(u32)__stack_end),191,0,TRUE); + __lwp_thread_init(_thr_main,__stack_end,((u32)__stack_addr-(u32)__stack_end),191,0,true); __lwp_thread_start(_thr_main,(void*)__crtmain,NULL); __lwp_objmgr_open(&_lwp_thr_objects,&_thr_main->object); } -BOOL __lwp_thread_isalive(lwp_t thr_id) +bool __lwp_thread_isalive(lwp_t thr_id) { - if(thr_id==LWP_THREAD_NULL || LWP_OBJTYPE(thr_id)!=LWP_OBJTYPE_THREAD) return FALSE; + if(thr_id==LWP_THREAD_NULL || LWP_OBJTYPE(thr_id)!=LWP_OBJTYPE_THREAD) return false; lwp_cntrl *thethread = (lwp_cntrl*)__lwp_objmgr_getnoprotection(&_lwp_thr_objects,LWP_OBJMASKID(thr_id)); if(thethread) { u32 *stackbase = thethread->stack; if(stackbase[0]==0xDEADBABE && !__lwp_statedormant(thethread->cur_state) && !__lwp_statetransient(thethread->cur_state)) - return TRUE; + return true; } - return FALSE; + return false; } lwp_t __lwp_thread_currentid(void) @@ -174,9 +174,9 @@ lwp_t __lwp_thread_currentid(void) return _thr_executing->object.id; } -BOOL __lwp_thread_exists(lwp_t thr_id) +bool __lwp_thread_exists(lwp_t thr_id) { - if(thr_id==LWP_THREAD_NULL || LWP_OBJTYPE(thr_id)!=LWP_OBJTYPE_THREAD) return FALSE; + if(thr_id==LWP_THREAD_NULL || LWP_OBJTYPE(thr_id)!=LWP_OBJTYPE_THREAD) return false; return (__lwp_objmgr_getnoprotection(&_lwp_thr_objects,LWP_OBJMASKID(thr_id))!=NULL); } @@ -202,7 +202,7 @@ s32 LWP_CreateThread(lwp_t *thethread,void* (*entry)(void *),void *arg,void *sta lwp_thread = __lwp_cntrl_allocate(); if(!lwp_thread) return -1; - status = __lwp_thread_init(lwp_thread,stackbase,stack_size,__lwp_priotocore(prio),0,TRUE); + status = __lwp_thread_init(lwp_thread,stackbase,stack_size,__lwp_priotocore(prio),0,true); if(!status) { __lwp_cntrl_free(lwp_thread); __lwp_thread_dispatchenable(); @@ -246,7 +246,7 @@ s32 LWP_ResumeThread(lwp_t thethread) if(!lwp_thread) return -1; if(__lwp_statesuspended(lwp_thread->cur_state)) { - __lwp_thread_resume(lwp_thread,TRUE); + __lwp_thread_resume(lwp_thread,true); __lwp_thread_dispatchenable(); return LWP_SUCCESSFUL; } @@ -274,7 +274,7 @@ void LWP_SetThreadPriority(lwp_t thethread,u32 prio) lwp_thread = __lwp_cntrl_open(thethread); if(!lwp_thread) return; - __lwp_thread_changepriority(lwp_thread,__lwp_priotocore(prio),TRUE); + __lwp_thread_changepriority(lwp_thread,__lwp_priotocore(prio),true); __lwp_thread_dispatchenable(); } @@ -292,15 +292,15 @@ void LWP_Reschedule(u32 prio) __lwp_thread_dispatchenable(); } -BOOL LWP_ThreadIsSuspended(lwp_t thethread) +bool LWP_ThreadIsSuspended(lwp_t thethread) { - BOOL state; + bool state; lwp_cntrl *lwp_thread; lwp_thread = __lwp_cntrl_open(thethread); - if(!lwp_thread) return FALSE; + if(!lwp_thread) return false; - state = (__lwp_statesuspended(lwp_thread->cur_state) ? TRUE : FALSE); + state = (__lwp_statesuspended(lwp_thread->cur_state) ? true : false); __lwp_thread_dispatchenable(); return state; diff --git a/libogc/lwp_heap.c b/libogc/lwp_heap.c index 6e3e74871..e78e8f008 100644 --- a/libogc/lwp_heap.c +++ b/libogc/lwp_heap.c @@ -96,7 +96,7 @@ void* __lwp_heap_allocate(heap_cntrl *theheap,u32 size) return ptr; } -BOOL __lwp_heap_free(heap_cntrl *theheap,void *ptr) +bool __lwp_heap_free(heap_cntrl *theheap,void *ptr) { heap_block *block; heap_block *next_block; @@ -110,7 +110,7 @@ BOOL __lwp_heap_free(heap_cntrl *theheap,void *ptr) block = __lwp_heap_usrblockat(ptr); if(!__lwp_heap_blockin(theheap,block) || __lwp_heap_blockfree(block)) { _CPU_ISR_Restore(level); - return FALSE; + return false; } dsize = __lwp_heap_blocksize(block); @@ -118,14 +118,14 @@ BOOL __lwp_heap_free(heap_cntrl *theheap,void *ptr) if(!__lwp_heap_blockin(theheap,next_block) || (block->front_flag!=next_block->back_flag)) { _CPU_ISR_Restore(level); - return FALSE; + return false; } if(__lwp_heap_prev_blockfree(block)) { prev_block = __lwp_heap_prevblock(block); if(!__lwp_heap_blockin(theheap,prev_block)) { _CPU_ISR_Restore(level); - return FALSE; + return false; } if(__lwp_heap_blockfree(next_block)) { @@ -156,7 +156,7 @@ BOOL __lwp_heap_free(heap_cntrl *theheap,void *ptr) } _CPU_ISR_Restore(level); - return TRUE; + return true; } u32 __lwp_heap_getinfo(heap_cntrl *theheap,heap_iblock *theinfo) diff --git a/libogc/lwp_mutex.c b/libogc/lwp_mutex.c index 781d1c3c1..4ce78a64c 100644 --- a/libogc/lwp_mutex.c +++ b/libogc/lwp_mutex.c @@ -56,7 +56,7 @@ u32 __lwp_mutex_surrender(lwp_mutex *mutex) mutex->holder = NULL; if(__lwp_mutex_isinheritprio(&mutex->atrrs) || __lwp_mutex_isprioceiling(&mutex->atrrs)) { if(holder->res_cnt==0 && holder->real_prio!=holder->cur_prio) - __lwp_thread_changepriority(holder,holder->real_prio,TRUE); + __lwp_thread_changepriority(holder,holder->real_prio,true); } if((thethread=__lwp_threadqueue_dequeue(&mutex->wait_queue))) { @@ -77,7 +77,7 @@ void __lwp_mutex_seize_irq_blocking(lwp_mutex *mutex,u64 timeout) exec = _thr_executing; if(__lwp_mutex_isinheritprio(&mutex->atrrs)){ if(mutex->holder->cur_prio>exec->cur_prio) - __lwp_thread_changepriority(mutex->holder,exec->cur_prio,FALSE); + __lwp_thread_changepriority(mutex->holder,exec->cur_prio,false); } mutex->blocked_cnt++; @@ -86,7 +86,7 @@ void __lwp_mutex_seize_irq_blocking(lwp_mutex *mutex,u64 timeout) if(_thr_executing->wait.ret_code==LWP_MUTEX_SUCCESSFUL) { if(__lwp_mutex_isprioceiling(&mutex->atrrs)) { if(mutex->atrrs.prioceilcur_prio) - __lwp_thread_changepriority(exec,mutex->atrrs.prioceil,FALSE); + __lwp_thread_changepriority(exec,mutex->atrrs.prioceil,false); } } __lwp_thread_dispatchenable(); diff --git a/libogc/lwp_mutex.inl b/libogc/lwp_mutex.inl index c29f70e73..39069444d 100644 --- a/libogc/lwp_mutex.inl +++ b/libogc/lwp_mutex.inl @@ -61,7 +61,7 @@ static __inline__ u32 __lwp_mutex_seize_irq_trylock(lwp_mutex *mutex,u32 *isr_le if(priocurr>prioceiling) { __lwp_thread_dispatchdisable(); _CPU_ISR_Restore(level); - __lwp_thread_changepriority(mutex->holder,mutex->atrrs.prioceil,FALSE); + __lwp_thread_changepriority(mutex->holder,mutex->atrrs.prioceil,false); __lwp_thread_dispatchenable(); return 0; } diff --git a/libogc/lwp_threadq.c b/libogc/lwp_threadq.c index cc1a10df4..c54c9af58 100644 --- a/libogc/lwp_threadq.c +++ b/libogc/lwp_threadq.c @@ -496,7 +496,7 @@ u32 __lwp_threadqueue_extractproxy(lwp_cntrl *thethread) state = thethread->cur_state; if(__lwp_statewaitthreadqueue(state)) { __lwp_threadqueue_extract(thethread->wait.queue,thethread); - return TRUE; + return true; } - return FALSE; + return false; } diff --git a/libogc/lwp_threads.c b/libogc/lwp_threads.c index c7732a81a..1e4309ff8 100644 --- a/libogc/lwp_threads.c +++ b/libogc/lwp_threads.c @@ -190,10 +190,10 @@ void __thread_dispatch(void) _CPU_ISR_Disable(level); exec = _thr_executing; - while(_context_switch_want==TRUE) { + while(_context_switch_want==true) { heir = _thr_heir; _thread_dispatch_disable_level = 1; - _context_switch_want = FALSE; + _context_switch_want = false; _thr_executing = heir; _CPU_ISR_Restore(level); @@ -255,7 +255,7 @@ void __lwp_rotate_readyqueue(u32 prio) _thr_heir = (lwp_cntrl*)ready->first; if(exec!=_thr_heir) - _context_switch_want = TRUE; + _context_switch_want = true; #ifdef _LWPTHREADS_DEBUG kprintf("__lwp_rotate_readyqueue(%d,%p,%p)\n",prio,exec,_thr_heir); @@ -279,9 +279,9 @@ void __lwp_thread_yield(void) _CPU_ISR_Flash(level); if(__lwp_thread_isheir(exec)) _thr_heir = (lwp_cntrl*)ready->first; - _context_switch_want = TRUE; + _context_switch_want = true; } else if(!__lwp_thread_isheir(exec)) - _context_switch_want = TRUE; + _context_switch_want = true; _CPU_ISR_Restore(level); } @@ -308,7 +308,7 @@ void __lwp_thread_resettimeslice(void) if(__lwp_thread_isheir(exec)) _thr_heir = (lwp_cntrl*)ready->first; - _context_switch_want = TRUE; + _context_switch_want = true; _CPU_ISR_Restore(level); } @@ -339,7 +339,7 @@ void __lwp_thread_setstate(lwp_cntrl *thethread,u32 state) if(__lwp_thread_isheir(thethread)) __lwp_thread_calcheir(); if(__lwp_thread_isexec(thethread)) - _context_switch_want = TRUE; + _context_switch_want = true; #ifdef _LWPTHREADS_DEBUG kprintf("__lwp_thread_setstate(%d,%p,%p,%08x)\n",_context_switch_want,_thr_heir,thethread,thethread->cur_state); #endif @@ -364,7 +364,7 @@ void __lwp_thread_clearstate(lwp_cntrl *thethread,u32 state) _thr_heir = thethread; if(_thr_executing->is_preemptible || thethread->cur_prio==0) - _context_switch_want = TRUE; + _context_switch_want = true; } } } @@ -379,10 +379,10 @@ u32 __lwp_evaluatemode(void) exec = _thr_executing; if(!__lwp_stateready(exec->cur_state) || (!__lwp_thread_isheir(exec) && exec->is_preemptible)){ - _context_switch_want = TRUE; - return TRUE; + _context_switch_want = true; + return true; } - return FALSE; + return false; } void __lwp_thread_changepriority(lwp_cntrl *thethread,u32 prio,u32 prependit) @@ -414,7 +414,7 @@ void __lwp_thread_changepriority(lwp_cntrl *thethread,u32 prio,u32 prependit) if(!(_thr_executing==_thr_heir) && _thr_executing->is_preemptible) - _context_switch_want = TRUE; + _context_switch_want = true; _CPU_ISR_Restore(level); } @@ -457,7 +457,7 @@ void __lwp_thread_suspend(lwp_cntrl *thethread) __lwp_thread_calcheir(); if(__lwp_thread_isexec(thethread)) - _context_switch_want = TRUE; + _context_switch_want = true; _CPU_ISR_Restore(level); } @@ -492,7 +492,7 @@ void __lwp_thread_resume(lwp_cntrl *thethread,u32 force) _CPU_ISR_Disable(level); - if(force==TRUE) + if(force==true) thethread->suspendcnt = 0; else thethread->suspendcnt--; @@ -513,7 +513,7 @@ void __lwp_thread_resume(lwp_cntrl *thethread,u32 force) _thr_heir = thethread; if(_thr_executing->is_preemptible || thethread->cur_prio==0) - _context_switch_want = TRUE; + _context_switch_want = true; } } } @@ -572,7 +572,7 @@ void __lwp_thread_ready(lwp_cntrl *thethread) __lwp_thread_calcheir(); heir = _thr_heir; if(!(__lwp_thread_isexec(heir)) && _thr_executing->is_preemptible) - _context_switch_want = TRUE; + _context_switch_want = true; _CPU_ISR_Restore(level); } @@ -594,11 +594,11 @@ u32 __lwp_thread_init(lwp_cntrl *thethread,void *stack_area,u32 stack_size,u32 p act_stack_size = __lwp_stack_allocate(thethread,act_stack_size); if(!act_stack_size) return 0; - thethread->stack_allocated = TRUE; + thethread->stack_allocated = true; } else { thethread->stack = stack_area; act_stack_size = stack_size; - thethread->stack_allocated = FALSE; + thethread->stack_allocated = false; } thethread->stack_size = act_stack_size; @@ -722,7 +722,7 @@ void __lwp_thread_startmultitasking(void) __sys_state_set(SYS_STATE_BEGIN_MT); __sys_state_set(SYS_STATE_UP); - _context_switch_want = FALSE; + _context_switch_want = false; _thr_executing = _thr_heir; #ifdef _LWPTHREADS_DEBUG kprintf("__lwp_start_multitasking(%p,%p)\n",_thr_executing,_thr_heir); @@ -753,7 +753,7 @@ void __lwp_thread_coreinit(void) __lwp_thread_dispatchinitialize(); __lwp_thread_inittimeslice(); - _context_switch_want = FALSE; + _context_switch_want = false; _thr_executing = NULL; _thr_heir = NULL; _thr_allocated_fp = NULL; diff --git a/libogc/lwp_wkspace.inl b/libogc/lwp_wkspace.inl index 7f9d2d148..e89825ce4 100644 --- a/libogc/lwp_wkspace.inl +++ b/libogc/lwp_wkspace.inl @@ -9,7 +9,7 @@ static __inline__ void* __lwp_wkspace_allocate(u32 size) return __lwp_heap_allocate(&__wkspace_heap,size); } -static __inline__ BOOL __lwp_wkspace_free(void *ptr) +static __inline__ bool __lwp_wkspace_free(void *ptr) { return __lwp_heap_free(&__wkspace_heap,ptr); } diff --git a/libogc/malloc_lock.c b/libogc/malloc_lock.c index cd1ec9f60..eead51b26 100644 --- a/libogc/malloc_lock.c +++ b/libogc/malloc_lock.c @@ -29,7 +29,7 @@ void __memlock_init(void) attr.mode = LWP_MUTEX_FIFO; attr.nest_behavior = LWP_MUTEX_NEST_ACQUIRE; - attr.onlyownerrelease = TRUE; + attr.onlyownerrelease = true; attr.prioceil = 1; __lwp_mutex_initialize(&mem_lock,&attr,LWP_MUTEX_UNLOCKED); } @@ -44,7 +44,7 @@ void __libogc_malloc_lock(struct _reent *r) if(!initialized) return; _CPU_ISR_Disable(level); - __lwp_mutex_seize(&mem_lock,MEMLOCK_MUTEX_ID,TRUE,LWP_THREADQ_NOTIMEOUT,level); + __lwp_mutex_seize(&mem_lock,MEMLOCK_MUTEX_ID,true,LWP_THREADQ_NOTIMEOUT,level); } void __libogc_malloc_unlock(struct _reent *r) @@ -64,7 +64,7 @@ void __libogc_malloc_lock(struct _reent *ptr) if(!initialized) return; _CPU_ISR_Disable(level); - __lwp_mutex_seize(&mem_lock,MEMLOCK_MUTEX_ID,TRUE,LWP_THREADQ_NOTIMEOUT,level); + __lwp_mutex_seize(&mem_lock,MEMLOCK_MUTEX_ID,true,LWP_THREADQ_NOTIMEOUT,level); ptr->_errno = _thr_executing->wait.ret_code; } diff --git a/libogc/message.c b/libogc/message.c index 2dccc61c9..4889d2b97 100644 --- a/libogc/message.c +++ b/libogc/message.c @@ -121,49 +121,49 @@ void MQ_Close(mqbox_t mqbox) __lwp_mqbox_free(mbox); } -BOOL MQ_Send(mqbox_t mqbox,mqmsg_t msg,u32 flags) +bool MQ_Send(mqbox_t mqbox,mqmsg_t msg,u32 flags) { - BOOL ret; + bool ret; mqbox_st *mbox; - u32 wait = (flags==MQ_MSG_BLOCK)?TRUE:FALSE; + u32 wait = (flags==MQ_MSG_BLOCK)?true:false; mbox = __lwp_mqbox_open(mqbox); - if(!mbox) return FALSE; + if(!mbox) return false; - ret = FALSE; - if(__lwpmq_submit(&mbox->mqueue,mbox->object.id,(void*)&msg,sizeof(mqmsg_t),LWP_MQ_SEND_REQUEST,wait,LWP_THREADQ_NOTIMEOUT)==LWP_MQ_STATUS_SUCCESSFUL) ret = TRUE; + ret = false; + if(__lwpmq_submit(&mbox->mqueue,mbox->object.id,(void*)&msg,sizeof(mqmsg_t),LWP_MQ_SEND_REQUEST,wait,LWP_THREADQ_NOTIMEOUT)==LWP_MQ_STATUS_SUCCESSFUL) ret = true; __lwp_thread_dispatchenable(); return ret; } -BOOL MQ_Receive(mqbox_t mqbox,mqmsg_t *msg,u32 flags) +bool MQ_Receive(mqbox_t mqbox,mqmsg_t *msg,u32 flags) { - BOOL ret; + bool ret; mqbox_st *mbox; - u32 tmp,wait = (flags==MQ_MSG_BLOCK)?TRUE:FALSE; + u32 tmp,wait = (flags==MQ_MSG_BLOCK)?true:false; mbox = __lwp_mqbox_open(mqbox); - if(!mbox) return FALSE; + if(!mbox) return false; - ret = FALSE; - if(__lwpmq_seize(&mbox->mqueue,mbox->object.id,(void*)msg,&tmp,wait,LWP_THREADQ_NOTIMEOUT)==LWP_MQ_STATUS_SUCCESSFUL) ret = TRUE; + ret = false; + if(__lwpmq_seize(&mbox->mqueue,mbox->object.id,(void*)msg,&tmp,wait,LWP_THREADQ_NOTIMEOUT)==LWP_MQ_STATUS_SUCCESSFUL) ret = true; __lwp_thread_dispatchenable(); return ret; } -BOOL MQ_Jam(mqbox_t mqbox,mqmsg_t msg,u32 flags) +bool MQ_Jam(mqbox_t mqbox,mqmsg_t msg,u32 flags) { - BOOL ret; + bool ret; mqbox_st *mbox; - u32 wait = (flags==MQ_MSG_BLOCK)?TRUE:FALSE; + u32 wait = (flags==MQ_MSG_BLOCK)?true:false; mbox = __lwp_mqbox_open(mqbox); - if(!mbox) return FALSE; + if(!mbox) return false; - ret = FALSE; - if(__lwpmq_submit(&mbox->mqueue,mbox->object.id,(void*)&msg,sizeof(mqmsg_t),LWP_MQ_SEND_URGENT,wait,LWP_THREADQ_NOTIMEOUT)==LWP_MQ_STATUS_SUCCESSFUL) ret = TRUE; + ret = false; + if(__lwpmq_submit(&mbox->mqueue,mbox->object.id,(void*)&msg,sizeof(mqmsg_t),LWP_MQ_SEND_URGENT,wait,LWP_THREADQ_NOTIMEOUT)==LWP_MQ_STATUS_SUCCESSFUL) ret = true; __lwp_thread_dispatchenable(); return ret; diff --git a/libogc/mutex.c b/libogc/mutex.c index c84ceeba0..cf9d6d851 100644 --- a/libogc/mutex.c +++ b/libogc/mutex.c @@ -114,7 +114,7 @@ s32 LWP_MutexInit(mutex_t *mutex,bool use_recursive) attr.mode = LWP_MUTEX_FIFO; attr.nest_behavior = use_recursive?LWP_MUTEX_NEST_ACQUIRE:LWP_MUTEX_NEST_ERROR; - attr.onlyownerrelease = TRUE; + attr.onlyownerrelease = true; attr.prioceil = 1; //__lwp_priotocore(LWP_PRIO_MAX-1); __lwp_mutex_initialize(&ret->mutex,&attr,LWP_MUTEX_UNLOCKED); @@ -143,12 +143,12 @@ s32 LWP_MutexDestroy(mutex_t mutex) s32 LWP_MutexLock(mutex_t mutex) { - return __lwp_mutex_locksupp(mutex,LWP_THREADQ_NOTIMEOUT,TRUE); + return __lwp_mutex_locksupp(mutex,LWP_THREADQ_NOTIMEOUT,true); } s32 LWP_MutexTryLock(mutex_t mutex) { - return __lwp_mutex_locksupp(mutex,LWP_THREADQ_NOTIMEOUT,FALSE); + return __lwp_mutex_locksupp(mutex,LWP_THREADQ_NOTIMEOUT,false); } s32 LWP_MutexUnlock(mutex_t mutex) diff --git a/libogc/network_wii.c b/libogc/network_wii.c index 30c5e9bc6..f8afb9e06 100644 --- a/libogc/network_wii.c +++ b/libogc/network_wii.c @@ -279,7 +279,7 @@ static void* net_malloc(u32 size) return __lwp_heap_allocate(&__net_heap, size); } -static BOOL net_free(void *ptr) +static bool net_free(void *ptr) { return __lwp_heap_free(&__net_heap, ptr); } diff --git a/libogc/pad.c b/libogc/pad.c index 58b6368d7..b1ec04191 100644 --- a/libogc/pad.c +++ b/libogc/pad.c @@ -81,7 +81,7 @@ static s32 __pad_onreset(s32 final) if(__pad_samplingcallback!=NULL) PAD_SetSamplingCallback(NULL); - if(final==FALSE) { + if(final==false) { ret = PAD_Sync(); if(__pad_recalibrated$207==0 && ret) { __pad_recalibrated$207 = PAD_Recalibrate(0xf0000000); diff --git a/libogc/sdgecko_io.c b/libogc/sdgecko_io.c index 88d94b24d..c37bf1746 100644 --- a/libogc/sdgecko_io.c +++ b/libogc/sdgecko_io.c @@ -275,7 +275,7 @@ static void __exi_wait(s32 drv_no) static s32 __card_exthandler(s32 chn,s32 dev) { - _ioCardInserted[chn] = FALSE; + _ioCardInserted[chn] = false; _ioFlag[chn] = NOT_INITIALIZED; sdgecko_ejectedCB(chn); return 1; @@ -1142,22 +1142,22 @@ static bool __card_check(s32 drv_no) { s32 ret; - if(drv_no<0 || drv_no>=MAX_DRIVE) return FALSE; + if(drv_no<0 || drv_no>=MAX_DRIVE) return false; #ifdef _CARDIO_DEBUG printf("__card_check(%d)\n",drv_no); #endif - if(drv_no==2) return TRUE; + if(drv_no==2) return true; while((ret=EXI_ProbeEx(drv_no))==0); - if(ret!=1) return FALSE; + if(ret!=1) return false; if(!(EXI_GetState(drv_no)&EXI_FLAG_ATTACH)) { - if(EXI_Attach(drv_no,__card_exthandler)==0) return FALSE; + if(EXI_Attach(drv_no,__card_exthandler)==0) return false; #ifdef _CARDIO_DEBUG printf("__card_check(%d, attached)\n",drv_no); #endif sdgecko_insertedCB(drv_no); } - return TRUE; + return true; } static s32 __card_retrycb(s32 drv_no) @@ -1196,7 +1196,7 @@ void sdgecko_initIODefault(void) for(i=0;i=MAX_DRIVE) return CARDIO_ERROR_NOCARD; - if(_ioCardInserted[drv_no]==TRUE) { - _ioCardInserted[drv_no] = FALSE; + if(_ioCardInserted[drv_no]==true) { + _ioCardInserted[drv_no] = false; _ioFlag[drv_no] = NOT_INITIALIZED; if(drv_no!=2) EXI_Detach(drv_no); sdgecko_ejectedCB(drv_no); diff --git a/libogc/semaphore.c b/libogc/semaphore.c index 98b058485..bb81d2f70 100644 --- a/libogc/semaphore.c +++ b/libogc/semaphore.c @@ -114,7 +114,7 @@ s32 LWP_SemWait(sem_t sem) lwp_sem = __lwp_sema_open(sem); if(!lwp_sem) return -1; - __lwp_sema_seize(&lwp_sem->sema,lwp_sem->object.id,TRUE,LWP_THREADQ_NOTIMEOUT); + __lwp_sema_seize(&lwp_sem->sema,lwp_sem->object.id,true,LWP_THREADQ_NOTIMEOUT); __lwp_thread_dispatchenable(); switch(_thr_executing->wait.ret_code) { diff --git a/libogc/si.c b/libogc/si.c index 48c557d70..10d9b7286 100644 --- a/libogc/si.c +++ b/libogc/si.c @@ -715,7 +715,7 @@ u32 SI_RegisterPollingHandler(RDSTHandler handler) for(i=0;i<4;i++) { if(rdstHandlers[i]==NULL) { rdstHandlers[i] = handler; - SI_EnablePollingInterrupt(TRUE); + SI_EnablePollingInterrupt(true); _CPU_ISR_Restore(level); return 1; } @@ -736,7 +736,7 @@ u32 SI_UnregisterPollingHandler(RDSTHandler handler) for(i=0;i<4;i++) { if(rdstHandlers[i]!=NULL) break; } - if(i>=4) SI_EnablePollingInterrupt(FALSE); + if(i>=4) SI_EnablePollingInterrupt(false); _CPU_ISR_Restore(level); return 1; diff --git a/libogc/system.c b/libogc/system.c index b1b17c6a2..fae42d54e 100644 --- a/libogc/system.c +++ b/libogc/system.c @@ -331,7 +331,7 @@ static alarm_st* __lwp_syswd_allocate(void) static s32 __mem_onreset(s32 final) { - if(final==TRUE) { + if(final==true) { _memReg[8] = 255; __UnmaskIrq(IM_MEM0|IM_MEM1|IM_MEM2|IM_MEM3); } @@ -1134,20 +1134,20 @@ void SYS_ResetSystem(s32 reset,u32 reset_code,s32 force_menu) __dsp_shutdown(); if(reset==SYS_SHUTDOWN) { - ret = __PADDisableRecalibration(TRUE); + ret = __PADDisableRecalibration(true); } - while(__call_resetfuncs(FALSE)==0); + while(__call_resetfuncs(false)==0); - if(reset==SYS_HOTRESET && force_menu==TRUE) { + if(reset==SYS_HOTRESET && force_menu==true) { sram = __SYS_LockSram(); sram->flags |= SRAM_BOOTIPL_BIT; - __SYS_UnlockSram(TRUE); + __SYS_UnlockSram(true); while(!__SYS_SyncSram()); } __exception_closeall(); - __call_resetfuncs(TRUE); + __call_resetfuncs(true); LCDisable(); @@ -1182,10 +1182,10 @@ void SYS_ResetSystem(s32 reset,u32 reset_code,s32 force_menu) __dsp_shutdown(); if(reset==SYS_SHUTDOWN) { - ret = __PADDisableRecalibration(TRUE); + ret = __PADDisableRecalibration(true); } - while(__call_resetfuncs(FALSE)==0); + while(__call_resetfuncs(false)==0); switch(reset) { case SYS_RESTART: @@ -1219,7 +1219,7 @@ void SYS_ResetSystem(s32 reset,u32 reset_code,s32 force_menu) __IOS_ShutdownSubsystems(); __exception_closeall(); - __call_resetfuncs(TRUE); + __call_resetfuncs(true); LCDisable(); diff --git a/lwip/core/sys.c b/lwip/core/sys.c index a7dbf34da..c5ed9ed00 100644 --- a/lwip/core/sys.c +++ b/lwip/core/sys.c @@ -244,7 +244,7 @@ sswt_handler(void *arg) { struct sswt_cb *sswt_cb = (struct sswt_cb *) arg; - /* Timeout. Set flag to TRUE and signal semaphore */ + /* Timeout. Set flag to true and signal semaphore */ sswt_cb->timeflag = 1; sys_sem_signal(*(sswt_cb->psem)); } diff --git a/lwip/network.c b/lwip/network.c index 961e1713a..bf6f0b9e7 100644 --- a/lwip/network.c +++ b/lwip/network.c @@ -372,7 +372,7 @@ static err_t netconn_delete(struct netconn *conn) mbox = conn->recvmbox; conn->recvmbox = SYS_MBOX_NULL; if(mbox!=SYS_MBOX_NULL) { - while(MQ_Receive(mbox,(mqmsg_t)&mem,MQ_MSG_NOBLOCK)==TRUE) { + while(MQ_Receive(mbox,(mqmsg_t)&mem,MQ_MSG_NOBLOCK)==true) { if(mem!=NULL) { if(conn->type==NETCONN_TCP) pbuf_free((struct pbuf*)mem); @@ -386,7 +386,7 @@ static err_t netconn_delete(struct netconn *conn) mbox = conn->acceptmbox; conn->acceptmbox = SYS_MBOX_NULL; if(mbox!=SYS_MBOX_NULL) { - while(MQ_Receive(mbox,(mqmsg_t)&mem,MQ_MSG_NOBLOCK)==TRUE) { + while(MQ_Receive(mbox,(mqmsg_t)&mem,MQ_MSG_NOBLOCK)==true) { if(mem!=NULL) netconn_delete((struct netconn*)mem); } MQ_Close(mbox); @@ -1493,7 +1493,7 @@ s32 if_configex(struct in_addr *local_ip,struct in_addr *netmask,struct in_addr gw.addr = 0; if (g_netinitiated < 3) { - if(use_dhcp==FALSE) { + if(use_dhcp==false) { if( !gateway || gateway->s_addr==0 || !local_ip || local_ip->s_addr==0 || !netmask || netmask->s_addr==0 ) return -1; @@ -1507,7 +1507,7 @@ s32 if_configex(struct in_addr *local_ip,struct in_addr *netmask,struct in_addr netif_set_up(pnet); netif_set_default(pnet); #if (LWIP_DHCP) - if(use_dhcp==TRUE) { + if(use_dhcp==true) { //setup coarse timer tb.tv_sec = DHCP_COARSE_TIMER_SECS; tb.tv_nsec = 0; @@ -1542,7 +1542,7 @@ s32 if_configex(struct in_addr *local_ip,struct in_addr *netmask,struct in_addr ret = net_init(); if (ret >= 0) { - if (use_dhcp == TRUE) { + if (use_dhcp == true) { int retries = max_retries; // wait for dhcp to bind while ( g_hNetIF.dhcp->state != DHCP_BOUND && retries > 0 ) { @@ -1585,7 +1585,7 @@ s32 if_config(char *local_ip, char *netmask, char *gateway,bool use_dhcp, int ma if (ret<0) return ret; - if ( use_dhcp == TRUE ) { + if ( use_dhcp == true ) { //copy back network addresses if ( local_ip != NULL ) strcpy(local_ip, inet_ntoa( loc_ip )); if ( netmask != NULL ) strcpy(netmask, inet_ntoa( mask)); @@ -2059,7 +2059,7 @@ s32 net_select(s32 maxfdp1,fd_set *readset,fd_set *writeset,fd_set *exceptset,st return 0; } - LWP_MutexInit(&sel_cb.cond_lck,FALSE); + LWP_MutexInit(&sel_cb.cond_lck,false); LWP_CondInit(&sel_cb.cond); sel_cb.next = selectcb_list; selectcb_list = &sel_cb; diff --git a/wiiuse/wpad.c b/wiiuse/wpad.c index a0cb3169a..2c1ec3dc3 100644 --- a/wiiuse/wpad.c +++ b/wiiuse/wpad.c @@ -120,7 +120,7 @@ static sys_resetinfo __wpad_resetinfo = { static s32 __wpad_onreset(s32 final) { //printf("__wpad_onreset(%d)\n",final); - if(final==FALSE) { + if(final==false) { WPAD_Shutdown(); } return 1;