Skip to content

Commit

Permalink
Bool: Drop usage of bools, too hard in mixed C/C++
Browse files Browse the repository at this point in the history
  • Loading branch information
kallisti5 committed Dec 14, 2014
1 parent 5dfa250 commit 68bb7d7
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 43 deletions.
6 changes: 3 additions & 3 deletions src/PCEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ PCEngine::PCEngine()
fReady(0),
fOptions(&option)
{
fOptions->want_fullscreen = FALSE;
fOptions->want_fullscreen_aspect = FALSE;
fOptions->configure_joypads = FALSE;
fOptions->want_fullscreen = 0;
fOptions->want_fullscreen_aspect = 0;
fOptions->configure_joypads = 0;

// 2 is a good default multiplier for modern desktops
fOptions->window_size = 2;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/gfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ typedef struct {
typeof(io.VDC[BXR].W) scroll_x;
typeof(io.VDC[BYR].W) scroll_y;
int scroll_y_diff;
typeof(io.VDC[CR].W) cr;
typeof(io.VDC[CR].W) cr;
} gfx_context;


Expand Down
2 changes: 1 addition & 1 deletion src/engine/hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ HCD_play_sectors(int begin_sect, int sect_len, char repeat)
&& begin_sect - CD_track[result].beg_lsn < 150)
Mix_PlayMusic(sdlmixmusic[result], repeat);
else /* can't yet easily repeat "inside" a track */
Mix_PlayMusic(sdlmixmusic[result], FALSE);
Mix_PlayMusic(sdlmixmusic[result], 0);

Mix_RewindMusic();
if (Mix_SetMusicPosition
Expand Down
6 changes: 3 additions & 3 deletions src/engine/pce.c
Original file line number Diff line number Diff line change
Expand Up @@ -1366,7 +1366,7 @@ IO_write(uint16 A, uchar V)
A, V, A & 0x1CC0,
reg_pc);
#endif
// DebugDumpTrace(4, TRUE);
// DebugDumpTrace(4, 1);
}


Expand Down Expand Up @@ -2108,7 +2108,7 @@ InitPCE(char *name)
}

if ((NO_ROM != 0xFFFF) && (kKnownRoms[NO_ROM].Flags & POPULOUS)) {
populus = TRUE;
populus = 1;

MESSAGE_INFO("Special Rom: Populous detected!\n");
if (!(PopRAM = (uchar*)malloc(PopRAMsize)))
Expand All @@ -2125,7 +2125,7 @@ InitPCE(char *name)
ROMMapR[0x43] = PopRAM + 0x6000;

} else {
populus = FALSE;
populus = 0;
PopRAM = NULL;
}

Expand Down
18 changes: 9 additions & 9 deletions src/engine/pce.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "cleantypes.h"


#if defined(LINUX)
#if defined(__linux__)
#include <sys/param.h>
#include <sys/types.h>
#include <sys/ioctl.h>
Expand Down Expand Up @@ -169,10 +169,10 @@ extern uchar binbcd[0x100];
extern uint32 pce_cd_sectoraddy;

struct host_sound {
bool stereo;
int stereo;
int signed_sound;
uint32 freq;
uint16 sample_size;
bool signed_sound;
};

struct host_machine {
Expand All @@ -182,12 +182,12 @@ struct host_machine {
extern struct host_machine host;

struct hugo_options {
bool want_fullscreen;
bool want_fullscreen_aspect;
bool configure_joypads;
bool want_arcade_card_emulation;
bool want_supergraphx_emulation;
bool want_television_size_emulation;
int want_fullscreen;
int want_fullscreen_aspect;
int configure_joypads;
int want_arcade_card_emulation;
int want_supergraphx_emulation;
int want_television_size_emulation;
uint16 window_size;
uint32 want_snd_freq;
uint32 wanted_hardware_format;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/pcecd.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ pce_cd_handle_write_1800(uint16 A, uchar V)
#endif
}
/* TEST
else { io.adpcm_rptr = io.adpcm_ptr.W; io.adpcm_firstread = TRUE; }
else { io.adpcm_rptr = io.adpcm_ptr.W; io.adpcm_firstread = 1; }
*/
/* TEST */
// if (V & 0x08) io.
Expand Down
2 changes: 1 addition & 1 deletion src/engine/shared_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ typedef struct tagIO {

uchar psg_da_data[6][PSG_DIRECT_ACCESS_BUFSIZE];
uint16 psg_da_index[6], psg_da_count[6];
bool psg_channel_disabled[6];
int psg_channel_disabled[6];

/* TIMER */
uchar timer_reload, timer_start, timer_counter;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ InitSound(void)
silent = 1;

if (smode == 0) // No sound
return TRUE;
return 1;

/* SDL Audio / Mixer Begin */
/*
Expand Down
4 changes: 2 additions & 2 deletions src/engine/sprite.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ CheckSprites(void)
w = (((spr->atr >> 8) & 1) + 1) * 16;
h = (((spr->atr >> 12) & 3) + 1) * 16;
if ((x < x0 + w0) && (x + w > x0) && (y < y0 + h0) && (y + h > y0))
return TRUE;
return 1;
}
return FALSE;
return 0;
}


Expand Down
8 changes: 0 additions & 8 deletions src/includes/cleantypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@
#define __CLEANTYPES_H


#ifndef FALSE
# define FALSE 0
#endif
#ifndef TRUE
# define TRUE 1
#endif


/*
* Set datatype sizes
* All SIZEOF_X defines are in bytes
Expand Down
4 changes: 2 additions & 2 deletions src/includes/osd_sdl_snd.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
extern Uint8 *stream;
extern Mix_Chunk *chunk;
extern SDL_AudioCVT cvt;
extern bool Callback_Stop;
extern bool USE_S16;
extern int Callback_Stop;
extern int USE_S16;

#endif
8 changes: 4 additions & 4 deletions src/osd_keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ sdl_config_joypad_axis(short which, joymap axis, uint16 * bad_axes,
uint16 num_axes) {

uchar t;
bool done = FALSE;
int done = 0;

while (1) {
if (read (fileno (stdin), &t, 1) == -1)
Expand Down Expand Up @@ -289,7 +289,7 @@ sdl_config_joypad_button (short which, joymap button, uint16 * bad_buttons,
uint16 num_buttons)
{
uchar t;
bool done = FALSE;
int done = 0;

while (1) {
if (read (fileno (stdin), &t, 1) == -1)
Expand Down Expand Up @@ -320,7 +320,7 @@ sdl_config_joypad_button (short which, joymap button, uint16 * bad_buttons,
config[current_config].individual_config[which]
.joy_mapping[button] = buttons;

done = TRUE;
done = 1;

stime = time (NULL);

Expand All @@ -331,7 +331,7 @@ sdl_config_joypad_button (short which, joymap button, uint16 * bad_buttons,

if ((ntime - stime) > 3) {
bad_buttons[buttons] = 1;
done = FALSE;
done = 0;

printf
(" ** Button %d still claiming to be pressed after 3 seconds, marked as invalid\n\n"
Expand Down
4 changes: 2 additions & 2 deletions src/osd_sdl_music.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Mix_Music *sdlmixmusic[MAX_SONGS];
void
sdlmixer_fill_audio(int channel)
{
if (Callback_Stop == TRUE) {
if (Callback_Stop == 1) {
// free things and
//stop calling backs...
if (chunk)
Expand Down Expand Up @@ -59,7 +59,7 @@ sdlmixer_fill_audio(int channel)
// Mix streams and apply master volume.
//

if ( USE_S16 == TRUE ) {
if (USE_S16 == 1) {
for (i = 0; i < cvt.len ; i++) {
cvt.buf[i] = 128 + ((uint32) ((sbuf[0][i] + sbuf[1][i] + sbuf[2][i] + sbuf[3][i] + sbuf[4][i] + sbuf[5][i]
+ adpcmbuf[i]) * (!(i % 2) ? lvol : rvol)) >> 7);
Expand Down
10 changes: 5 additions & 5 deletions src/osd_sdl_snd.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
Uint8 *stream;
Mix_Chunk *chunk;
SDL_AudioCVT cvt;
bool Callback_Stop;
bool USE_S16;
int Callback_Stop;
int USE_S16;


void
Expand Down Expand Up @@ -65,7 +65,7 @@ osd_snd_init_sound(void)
host.sound.freq = option.want_snd_freq;

if (Mix_OpenAudio((host.sound.freq), (USE_S16 ? AUDIO_S16 : AUDIO_U8),
(USE_S16?2:host.sound.stereo), sbuf_size) < 0) {
(USE_S16 ? 2 : host.sound.stereo), sbuf_size) < 0) {
Log("Couldn't open audio: %s\n", Mix_GetError());
return 0;
}
Expand All @@ -88,7 +88,7 @@ osd_snd_init_sound(void)


// sets the callback
Callback_Stop = FALSE;
Callback_Stop = 0;
Mix_AllocateChannels(1);
Mix_ChannelFinished(sdlmixer_fill_audio);

Expand Down Expand Up @@ -123,7 +123,7 @@ osd_snd_trash_sound(void)
osd_snd_set_volume(0);

//needed to stop properly...
Callback_Stop=TRUE;
Callback_Stop = 1;
//SDL_Delay(1000);
Mix_CloseAudio();

Expand Down

1 comment on commit 68bb7d7

@mckaygerhard
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks this commit able to backported more easy to older systems

Please sign in to comment.