int rc_sourcefile(char *filename) { FILE *f; char *name; char line[256], *p; name = path_search(filename, "r", rcpath); f = fopen(name, "r"); if (!f) return -1; for (;;) { if (feof(f)) break; fgets(line, sizeof line, f); if ((p = strpbrk(line, "#\r\n"))) *p = 0; rc_command(line); } fclose(f); return 0; } rcvar_t rcfile_exports[] = { RCV_STRING("rcpath", &rcpath), RCV_END };
#include "gnuboy.h" #include "fb.h" #include "input.h" #include "rc.h" struct fb fb; static char *skinfile; static frameskip = 0; int framecounter = 0; rcvar_t vid_exports[] = { RCV_INT("frameskip", &frameskip), RCV_STRING("skin", &skinfile), RCV_END }; void vid_setpal(int i, int r, int g, int b) { } void vid_settitle(char * title) { char caption[30] = "Gnuboy EX - "; strncat(caption, title, 16); lcdc_set_vram_address((void*)0xAC200000);
strcpy(sramfile, saveprefix); strcat(sramfile, ".sav"); rtcfile = malloc(strlen(saveprefix) + 5); strcpy(rtcfile, saveprefix); strcat(rtcfile, ".rtc"); sram_load(); rtc_load(); atexit(cleanup); } rcvar_t loader_exports[] = { RCV_STRING("savedir", &savedir), RCV_STRING("savename", &savename), RCV_INT("saveslot", &saveslot), RCV_BOOL("forcebatt", &forcebatt), RCV_BOOL("nobatt", &nobatt), RCV_BOOL("forcedmg", &forcedmg), RCV_BOOL("gbamode", &gbamode), RCV_INT("memfill", &memfill), RCV_INT("memrand", &memrand), RCV_END };
struct pcm pcm; static char *dsp_device; static int stereo = 0; static int samplerate = 11025; static int sound = 1; snd_pcm_t *playback_handle; #define DSP_DEVICE "hw:0,0" rcvar_t pcm_exports[] = { RCV_BOOL("sound", &sound), RCV_INT("stereo", &stereo), RCV_INT("samplerate", &samplerate), RCV_STRING("alsa_device", &dsp_device), RCV_END }; void pcm_init() { int n, m, err; snd_pcm_hw_params_t *hw_params; if (!sound) { pcm.hz = 11025; pcm.len = 4096; pcm.buf = malloc(pcm.len); pcm.pos = 0;
static int fbfd = -1; static byte *fbmap; static int maplen; static byte *mmio; static int bes; static int base; static int use_yuv = -1; static int use_interp = 1; static struct fb_fix_screeninfo fi; static struct fb_var_screeninfo vi, initial_vi; rcvar_t vid_exports[] = { RCV_VECTOR("vmode", &vmode, 3), RCV_STRING("fb_device", &fb_device), RCV_STRING("fb_mode", &fb_mode), RCV_INT("fb_depth", &fb_depth), RCV_BOOL("yuv", &use_yuv), RCV_BOOL("yuvinterp", &use_interp), RCV_END }; static void wrio4(int a, int v) { #ifndef IS_LITTLE_ENDIAN v = (v<<24) | ((v&0xff00)<<8) | ((v&0xff0000)>>8) | (v>>24); #endif *(int*)(mmio+a) = v;
name = strdup(base(romfile)); p = (char *) strchr(name, '.'); if (p) *p = 0; sramfile = malloc(strlen(savedir) + strlen(name) + 7); sprintf(sramfile, "%s%s.sav", savedir, name); rtcfile = malloc(strlen(savedir) + strlen(name) + 7); sprintf(rtcfile, "%s%s.rtc", savedir, name); printf("Loading sramfile: %s\n", sramfile); printf("Loading rtcfile: %s\n", rtcfile); sram_load(); rtc_load(); } rcvar_t loader_exports[] = { RCV_STRING("savedir", &savedir), RCV_STRING("romdir", &romdir), RCV_BOOL("forcebatt", &forcebatt), RCV_BOOL("nobatt", &nobatt), RCV_BOOL("forcedmg", &forcedmg), RCV_BOOL("gbamode", &gbamode), RCV_INT("memfill", &memfill), RCV_INT("memrand", &memrand), RCV_END };