fix all implicit declarations

This commit is contained in:
rofl0r 2012-06-23 16:38:19 +02:00
parent 406ea7de7a
commit ebcf9189b1
42 changed files with 279 additions and 53 deletions

2
cpu.c
View File

@ -10,6 +10,8 @@
#include "fastmem.h" #include "fastmem.h"
#include "cpuregs.h" #include "cpuregs.h"
#include "cpucore.h" #include "cpucore.h"
#include "lcdc.h"
#include "debug.h"
#ifdef USE_ASM #ifdef USE_ASM
#include "asm.h" #include "asm.h"

9
cpu.h
View File

@ -28,8 +28,13 @@ struct cpu
extern struct cpu cpu; extern struct cpu cpu;
void cpu_reset();
void div_advance(int cnt);
void timer_advance(int cnt);
void lcdc_advance(int cnt);
void sound_advance(int cnt);
void cpu_timers(int cnt);
int cpu_emulate(int cycles);
#endif #endif

7
debug.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef DEBUG_H
#define DEBUG_H
void debug_disassemble(addr a, int c);
#endif

4
defs.h
View File

@ -28,7 +28,9 @@ typedef signed int n32;
typedef un16 word; typedef un16 word;
typedef word addr; typedef word addr;
/* stuff from main.c ... */
void die(char *fmt, ...);
void doevents();

4
emu.c
View File

@ -8,6 +8,10 @@
#include "mem.h" #include "mem.h"
#include "lcd.h" #include "lcd.h"
#include "rc.h" #include "rc.h"
#include "rtc.h"
#include "sys.h"
#include "sound.h"
#include "cpu.h"
static int framelen = 16743; static int framelen = 16743;

9
emu.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef EMU_H
#define EMU_H
void emu_run();
void emu_reset();
#endif

View File

@ -1,5 +1,4 @@
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "rc.h" #include "rc.h"

8
exports.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef EXPORTS_H
#define EXPORTS_H
void show_exports();
void init_exports();
#endif

2
hw.c
View File

@ -1,4 +1,4 @@
#include <string.h>
#include "defs.h" #include "defs.h"

7
hw.h
View File

@ -34,6 +34,13 @@ struct hw
extern struct hw hw; extern struct hw hw;
void hw_interrupt(byte i, byte mask);
void hw_dma(byte b);
void hw_hdma();
void hw_hdma_cmd(byte c);
void hw_reset();
void pad_refresh();
void pad_set(byte k, int st);
#endif #endif

7
inflate.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef INFLATE_H
#define INFLATE_H
int unzip (const unsigned char *data, long *p, void (* callback) (unsigned char d));
#endif

View File

@ -6,6 +6,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h>
#include <strings.h>
#include "input.h" #include "input.h"

5
lcd.c
View File

@ -1,6 +1,7 @@
#include <string.h>
#include "refresh.h"
#include "palette.h"
#include "defs.h" #include "defs.h"
#include "regs.h" #include "regs.h"
#include "hw.h" #include "hw.h"

20
lcd.h
View File

@ -47,7 +47,25 @@ struct lcd
extern struct lcd lcd; extern struct lcd lcd;
extern struct scan scan; extern struct scan scan;
void updatepatpix();
void tilebuf();
void bg_scan();
void wnd_scan();
void bg_scan_pri();
void wnd_scan_pri();
void bg_scan_color();
void wnd_scan_color();
void spr_count();
void spr_enum();
void spr_scan();
void lcd_begin();
void lcd_refreshline();
void pal_write(int i, byte b);
void pal_write_dmg(int i, int mapnum, byte d);
void vram_write(int a, byte b);
void vram_dirty();
void pal_dirty();
void lcd_reset();

2
lcdc.c
View File

@ -6,7 +6,7 @@
#include "hw.h" #include "hw.h"
#include "cpu.h" #include "cpu.h"
#include "regs.h" #include "regs.h"
#include "lcd.h"
#define C (cpu.lcdc) #define C (cpu.lcdc)

11
lcdc.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef LCDC_H
#define LCDC_H
void lcdc_change(byte b);
void lcdc_trans();
void stat_write(byte b);
void stat_trigger();
#endif

View File

@ -1,4 +1,13 @@
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809L
#undef _GNU_SOURCE
#define _GNU_SOURCE
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <time.h>
#include "defs.h" #include "defs.h"
#include "regs.h" #include "regs.h"
@ -6,12 +15,11 @@
#include "hw.h" #include "hw.h"
#include "rtc.h" #include "rtc.h"
#include "rc.h" #include "rc.h"
#include "lcd.h"
#include <stdio.h> #include "inflate.h"
#include <stdlib.h> #include "save.h"
#include <string.h> #include "sound.h"
#include "sys.h"
char *strdup();
static int mbc_table[256] = static int mbc_table[256] =
{ {

View File

@ -21,7 +21,9 @@ int rom_load();
int sram_load(); int sram_load();
int sram_save(); int sram_save();
void loader_init(char *s);
void state_save(int n);
void state_load(int n);
#endif #endif

18
main.c
View File

@ -1,21 +1,19 @@
#undef _GNU_SOURCE
#define _GNU_SOURCE
#include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
char *strdup();
#include <stdarg.h> #include <stdarg.h>
#include <signal.h> #include <signal.h>
#include "input.h" #include "input.h"
#include "rc.h" #include "rc.h"
#include "sys.h"
#include "rckeys.h"
#include "emu.h"
#include "exports.h"
#include "loader.h"
#include "Version" #include "Version"

2
mem.c
View File

@ -8,6 +8,8 @@
#include "mem.h" #include "mem.h"
#include "rtc.h" #include "rtc.h"
#include "lcd.h" #include "lcd.h"
#include "lcdc.h"
#include "sound.h"
struct mbc mbc; struct mbc mbc;
struct rom rom; struct rom rom;

1
mem.h
View File

@ -57,6 +57,7 @@ void ioreg_write(byte r, byte b);
void mbc_write(int a, byte b); void mbc_write(int a, byte b);
void mem_write(int a, byte b); void mem_write(int a, byte b);
byte mem_read(int a); byte mem_read(int a);
void mbc_reset();

View File

@ -1,8 +1,8 @@
#include <stdlib.h>
#include "defs.h" #include "defs.h"
#include "fb.h" #include "fb.h"
#include "sys.h"
static byte palmap[32768]; static byte palmap[32768];
static byte pallock[256]; static byte pallock[256];

13
palette.h Normal file
View File

@ -0,0 +1,13 @@
#ifndef PALETTE_H
#define PALETTE_H
#include "defs.h"
void pal_lock(byte n);
void pal_release(byte n);
void pal_expire();
void pal_set332();
byte pal_getcolor(int c, int r, int g, int b);
#endif

8
path.c
View File

@ -1,11 +1,9 @@
#undef _GNU_SOURCE
#define _GNU_SOURCE
#include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
char *strdup();
#ifdef ALT_PATH_SEP #ifdef ALT_PATH_SEP
#define SEP ';' #define SEP ';'

2
rc.h
View File

@ -55,6 +55,8 @@ int rc_getint(char *name);
int *rc_getvec(char *name); int *rc_getvec(char *name);
char *rc_getstr(char *name); char *rc_getstr(char *name);
int rc_command(char *line);
int rc_sourcefile(char *filename);
#endif #endif

View File

@ -1,13 +1,13 @@
#include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include "defs.h" #include "defs.h"
#include "rc.h" #include "rc.h"
#include "rckeys.h"
#include "hw.h" #include "hw.h"
#include "emu.h"
#include "loader.h"
#include "split.h"
/* /*

10
rckeys.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef RCKEYS_H
#define RCKEYS_H
void rc_dokey(int key, int st);
int rc_bindkey(char *keyname, char *cmd);
int rc_unbindkey(char *keyname);
void rc_unbindall();
#endif

View File

@ -1,11 +1,11 @@
#undef _GNU_SOURCE
#define _GNU_SOURCE
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdlib.h>
#include <ctype.h>
char *strdup();
#include "defs.h" #include "defs.h"
#include "rc.h" #include "rc.h"

20
refresh.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef REFRESH_H
#define REFRESH_H
#include "defs.h"
void refresh_1(byte *dest, byte *src, byte *pal, int cnt);
void refresh_2(un16 *dest, byte *src, un16 *pal, int cnt);
void refresh_3(byte *dest, byte *src, un32 *pal, int cnt);
void refresh_4(un32 *dest, byte *src, un32 *pal, int cnt);
void refresh_1_2x(byte *dest, byte *src, byte *pal, int cnt);
void refresh_2_2x(un16 *dest, byte *src, un16 *pal, int cnt);
void refresh_3_2x(byte *dest, byte *src, un32 *pal, int cnt);
void refresh_4_2x(un32 *dest, byte *src, un32 *pal, int cnt);
void refresh_2_3x(un16 *dest, byte *src, un16 *pal, int cnt);
void refresh_3_3x(byte *dest, byte *src, un32 *pal, int cnt);
void refresh_4_3x(un32 *dest, byte *src, un32 *pal, int cnt);
void refresh_3_4x(byte *dest, byte *src, un32 *pal, int cnt);
void refresh_4_4x(un32 *dest, byte *src, un32 *pal, int cnt);
#endif

1
rtc.c
View File

@ -2,6 +2,7 @@
#include <stdio.h> #include <stdio.h>
#include <time.h>
#include "defs.h" #include "defs.h"
#include "mem.h" #include "mem.h"

7
rtc.h
View File

@ -16,8 +16,15 @@ struct rtc
extern struct rtc rtc; extern struct rtc rtc;
#include "defs.h"
void rtc_latch(byte b);
void rtc_write(byte b);
void rtc_tick();
#include <stdio.h>
void rtc_save_internal(FILE *f);
void rtc_load_internal(FILE *f);
#endif #endif

2
save.c
View File

@ -1,5 +1,5 @@
#include <string.h>
#include <stdio.h> #include <stdio.h>
#include "defs.h" #include "defs.h"

10
save.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef SAVE_H
#define SAVE_H
#include <stdio.h>
void savestate(FILE *f);
void loadstate(FILE *f);
#endif

View File

@ -1,4 +1,4 @@
#include <string.h>
#include "defs.h" #include "defs.h"
@ -9,7 +9,7 @@
#include "regs.h" #include "regs.h"
#include "rc.h" #include "rc.h"
#include "noise.h" #include "noise.h"
#include "sys.h"
const static byte dmgwave[16] = const static byte dmgwave[16] =
{ {

12
sound.h
View File

@ -26,8 +26,18 @@ struct snd
extern struct snd snd; extern struct snd snd;
#include "defs.h"
void sound_write(byte r, byte b);
byte sound_read(byte r);
void sound_dirty();
void sound_off();
void sound_reset();
void sound_mix();
void s1_init();
void s2_init();
void s3_init();
void s4_init();

7
split.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef SPLIT_H
#define SPLIT_H
int splitline(char **argv, int max, char *line);
#endif

38
sys.h Normal file
View File

@ -0,0 +1,38 @@
#ifndef VID_H
#define VID_H
/* stuff implemented by the different sys/ backends */
void vid_begin();
void vid_end();
void vid_init();
void vid_preinit();
void vid_close();
void vid_setpal(int i, int r, int g, int b);
void vid_settitle(char *title);
void pcm_init();
int pcm_submit();
void pcm_close();
void ev_poll();
void sys_checkdir(char *path, int wr);
void sys_sleep(int us);
void sys_sanitize(char *s);
void joy_init();
void joy_poll();
void joy_close();
void kb_init();
void kb_poll();
void kb_close();
/* FIXME these have different prototype for obsolete ( == M$ ) platforms */
#include <sys/time.h>
int sys_elapsed(struct timeval *prev);
void sys_initpath();
#endif

View File

@ -7,10 +7,12 @@
* This file may be distributed under the terms of the GNU GPL. * This file may be distributed under the terms of the GNU GPL.
*/ */
#undef _GNU_SOURCE
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <stdio.h>
char *strdup();
#include <unistd.h> #include <unistd.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <linux/fb.h> #include <linux/fb.h>
@ -20,6 +22,7 @@ char *strdup();
#include "defs.h" #include "defs.h"
#include "fb.h" #include "fb.h"
#include "rc.h" #include "rc.h"
#include "sys.h"
#include "matrox.h" #include "matrox.h"
struct fb fb; struct fb fb;

View File

@ -1,8 +1,9 @@
#undef _GNU_SOURCE
#define _GNU_SOURCE
#include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
char *strdup();
#include <linux/joystick.h> #include <linux/joystick.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>

View File

@ -3,6 +3,10 @@
* *
* System interface for *nix systems. * System interface for *nix systems.
*/ */
#undef _GNU_SOURCE
#define _GNU_SOURCE
#undef _BSD_SOURCE
#define _BSD_SOURCE
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
@ -12,10 +16,14 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include "../../defs.h"
#include "../../rc.h"
#define DOTDIR ".gnuboy" #define DOTDIR ".gnuboy"
#ifndef HAVE_USLEEP #ifndef HAVE_USLEEP

View File

@ -1,8 +1,11 @@
#undef _GNU_SOURCE
#define _GNU_SOURCE
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
char *strdup();
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>

View File

@ -4,6 +4,8 @@
* Xlib interface. * Xlib interface.
* dist under gnu gpl * dist under gnu gpl
*/ */
#include <ctype.h>
#include "../../sys.h"
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"