mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-05 06:47:45 -04:00
linux port fixed; some cleanups
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@706 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
fa8d133192
commit
046c454067
18 changed files with 146 additions and 466 deletions
|
@ -13,7 +13,6 @@
|
|||
#include "code940/940shared.h"
|
||||
#include "soc_mmsp2.h"
|
||||
#include "soc.h"
|
||||
#include "emu.h"
|
||||
#include "../common/mp3.h"
|
||||
#include "../common/arm_utils.h"
|
||||
#include "../common/menu.h"
|
||||
|
|
|
@ -55,14 +55,14 @@ LD = $(CROSS)ld
|
|||
OBJCOPY = $(CROSS)objcopy
|
||||
|
||||
# frontend
|
||||
OBJS += main.o soc.o soc_mmsp2.o soc_pollux.o pollux_set.o emu.o in_gp2x.o plat.o warm.o
|
||||
OBJS += soc.o soc_mmsp2.o soc_pollux.o pollux_set.o emu.o in_gp2x.o plat.o warm.o
|
||||
# 940 core control
|
||||
OBJS += 940ctl.o
|
||||
|
||||
# common
|
||||
OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o platform/common/config.o \
|
||||
platform/common/arm_utils.o platform/common/arm_linux.o platform/common/readpng.o \
|
||||
platform/common/mp3_helix.o platform/common/input.o \
|
||||
platform/common/mp3_helix.o platform/common/input.o platform/common/main.o \
|
||||
platform/linux/sndout_oss.o platform/linux/plat.o
|
||||
|
||||
# Pico
|
||||
|
|
10
gp2x/emu.c
10
gp2x/emu.c
|
@ -1,4 +1,4 @@
|
|||
// (c) Copyright 2006-2007 notaz, All rights reserved.
|
||||
// (c) Copyright 2006-2009 notaz, All rights reserved.
|
||||
// Free for non-commercial use.
|
||||
|
||||
// For commercial use, separate licencing terms must be obtained.
|
||||
|
@ -8,15 +8,11 @@
|
|||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <linux/limits.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "emu.h"
|
||||
#include "plat_gp2x.h"
|
||||
#include "soc.h"
|
||||
#include "../common/plat.h"
|
||||
#include "../common/menu.h"
|
||||
#include "../common/arm_utils.h"
|
||||
#include "../common/fonts.h"
|
||||
|
@ -158,7 +154,7 @@ void emu_prepareDefaultConfig(void)
|
|||
defaultConfig.s_PicoOpt |= POPT_EXT_FM;
|
||||
}
|
||||
|
||||
void osd_text(int x, int y, const char *text)
|
||||
static void osd_text(int x, int y, const char *text)
|
||||
{
|
||||
int len = strlen(text)*8;
|
||||
int *p, i, h, offs;
|
||||
|
|
12
gp2x/emu.h
12
gp2x/emu.h
|
@ -1,12 +0,0 @@
|
|||
// (c) Copyright 2006-2007 notaz, All rights reserved.
|
||||
// Free for non-commercial use.
|
||||
|
||||
// For commercial use, separate licencing terms must be obtained.
|
||||
|
||||
|
||||
void emu_Init(void);
|
||||
void emu_Deinit(void);
|
||||
void emu_Loop(void);
|
||||
|
||||
void osd_text(int x, int y, const char *text);
|
||||
|
139
gp2x/main.c
139
gp2x/main.c
|
@ -1,139 +0,0 @@
|
|||
// (c) Copyright 2006-2009 notaz, All rights reserved.
|
||||
// Free for non-commercial use.
|
||||
|
||||
// For commercial use, separate licencing terms must be obtained.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include "../common/menu.h"
|
||||
#include "../common/emu.h"
|
||||
#include "../common/config.h"
|
||||
#include "../common/input.h"
|
||||
#include "../common/plat.h"
|
||||
#include "emu.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
extern char *PicoConfigFile;
|
||||
static int load_state_slot = -1;
|
||||
char **g_argv;
|
||||
|
||||
void parse_cmd_line(int argc, char *argv[])
|
||||
{
|
||||
int x, unrecognized = 0;
|
||||
|
||||
for (x = 1; x < argc; x++)
|
||||
{
|
||||
if (argv[x][0] == '-')
|
||||
{
|
||||
if (strcasecmp(argv[x], "-config") == 0) {
|
||||
if (x+1 < argc) { ++x; PicoConfigFile = argv[x]; }
|
||||
}
|
||||
else if (strcasecmp(argv[x], "-loadstate") == 0) {
|
||||
if (x+1 < argc) { ++x; load_state_slot = atoi(argv[x]); }
|
||||
}
|
||||
else {
|
||||
unrecognized = 1;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* External Frontend: ROM Name */
|
||||
FILE *f;
|
||||
strncpy(rom_fname_reload, argv[x], sizeof(rom_fname_reload));
|
||||
rom_fname_reload[sizeof(rom_fname_reload) - 1] = 0;
|
||||
f = fopen(rom_fname_reload, "rb");
|
||||
if (f) fclose(f);
|
||||
else unrecognized = 1;
|
||||
engineState = PGS_ReloadRom;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (unrecognized) {
|
||||
printf("\n\n\nPicoDrive v" VERSION " (c) notaz, 2006-2009\n");
|
||||
printf("usage: %s [options] [romfile]\n", argv[0]);
|
||||
printf("options:\n"
|
||||
" -config <file> use specified config file instead of default 'config.cfg'\n"
|
||||
" -loadstate <num> if ROM is specified, try loading slot <num>\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
g_argv = argv;
|
||||
|
||||
plat_early_init();
|
||||
|
||||
/* in_init() must go before config, config accesses in_ fwk */
|
||||
in_init();
|
||||
emu_prepareDefaultConfig();
|
||||
emu_ReadConfig(0, 0);
|
||||
config_readlrom(PicoConfigFile);
|
||||
|
||||
plat_init();
|
||||
in_probe();
|
||||
in_debug_dump();
|
||||
|
||||
emu_Init();
|
||||
menu_init();
|
||||
|
||||
engineState = PGS_Menu;
|
||||
|
||||
if (argc > 1)
|
||||
parse_cmd_line(argc, argv);
|
||||
|
||||
if (engineState == PGS_ReloadRom)
|
||||
{
|
||||
if (emu_ReloadRom(rom_fname_reload)) {
|
||||
engineState = PGS_Running;
|
||||
if (load_state_slot >= 0) {
|
||||
state_slot = load_state_slot;
|
||||
emu_SaveLoadGame(1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
switch (engineState)
|
||||
{
|
||||
case PGS_Menu:
|
||||
menu_loop();
|
||||
break;
|
||||
|
||||
case PGS_ReloadRom:
|
||||
if (emu_ReloadRom(rom_fname_reload))
|
||||
engineState = PGS_Running;
|
||||
else {
|
||||
printf("PGS_ReloadRom == 0\n");
|
||||
engineState = PGS_Menu;
|
||||
}
|
||||
break;
|
||||
|
||||
case PGS_RestartRun:
|
||||
engineState = PGS_Running;
|
||||
|
||||
case PGS_Running:
|
||||
emu_Loop();
|
||||
break;
|
||||
|
||||
case PGS_Quit:
|
||||
goto endloop;
|
||||
|
||||
default:
|
||||
printf("engine got into unknown state (%i), exitting\n", engineState);
|
||||
goto endloop;
|
||||
}
|
||||
}
|
||||
|
||||
endloop:
|
||||
|
||||
emu_Deinit();
|
||||
plat_finish();
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -3,8 +3,6 @@
|
|||
#ifndef PORT_CONFIG_H
|
||||
#define PORT_CONFIG_H
|
||||
|
||||
#include "version.h"
|
||||
|
||||
#define CASE_SENSITIVE_FS 1 // CS filesystem
|
||||
#define DONT_OPEN_MANY_FILES 0
|
||||
#define REDUCE_IO_CALLS 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue