mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
giz menu works
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@231 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
b39bf06ad7
commit
e5f426aa2e
35 changed files with 2507 additions and 432 deletions
173
platform/gizmondo/Makefile
Normal file
173
platform/gizmondo/Makefile
Normal file
|
@ -0,0 +1,173 @@
|
|||
|
||||
# you may or may not need to change this
|
||||
CROSS = /opt/cegcc/arm-wince-cegcc/bin/
|
||||
|
||||
# settings
|
||||
asm_memory = 1
|
||||
asm_render = 1
|
||||
asm_ym2612 = 1
|
||||
asm_misc = 1
|
||||
asm_cdpico = 1
|
||||
asm_cdmemory = 1
|
||||
amalgamate = 0
|
||||
#profile = 1
|
||||
|
||||
|
||||
|
||||
DEFINC = -I../.. -I. -D__GIZ__ -D_UNZIP_SUPPORT
|
||||
COPT_COMMON = -static -Wall -O2 -ftracer -fstrength-reduce -fomit-frame-pointer -fstrict-aliasing -ffast-math
|
||||
ifeq "$(profile)" "1"
|
||||
COPT_COMMON += -fprofile-generate
|
||||
endif
|
||||
ifeq "$(profile)" "2"
|
||||
COPT_COMMON += -fprofile-use
|
||||
endif
|
||||
COPT = $(COPT_COMMON) -mtune=arm920t
|
||||
ASFLAGS = -mcpu=arm920t -mfloat-abi=soft
|
||||
GCC = $(CROSS)gcc
|
||||
STRIP = $(CROSS)strip
|
||||
AS = $(CROSS)as
|
||||
LD = $(CROSS)ld
|
||||
|
||||
# frontend
|
||||
OBJS += main.o menu.o giz.o emu.o
|
||||
|
||||
# common
|
||||
OBJS += ../common/menu.o ../common/fonts.o ../common/arm_utils.o ../common/readpng.o
|
||||
|
||||
# Pico
|
||||
ifeq "$(amalgamate)" "1"
|
||||
OBJS += ../../PicoAll.o
|
||||
else
|
||||
OBJS += ../../Pico/Area.o ../../Pico/Cart.o ../../Pico/Memory.o ../../Pico/Misc.o \
|
||||
../../Pico/Pico.o ../../Pico/Sek.o ../../Pico/VideoPort.o ../../Pico/Draw2.o ../../Pico/Draw.o \
|
||||
../../Pico/Patch.o
|
||||
# Pico - CD
|
||||
OBJS += ../../Pico/cd/Pico.o ../../Pico/cd/Memory.o ../../Pico/cd/Sek.o ../../Pico/cd/LC89510.o \
|
||||
../../Pico/cd/cd_sys.o ../../Pico/cd/cd_file.o ../../Pico/cd/gfx_cd.o \
|
||||
../../Pico/cd/Area.o ../../Pico/cd/Misc.o ../../Pico/cd/pcm.o ../../Pico/cd/buffering.o
|
||||
endif
|
||||
|
||||
# asm stuff
|
||||
ifeq "$(asm_render)" "1"
|
||||
DEFINC += -D_ASM_DRAW_C
|
||||
OBJS += ../../Pico/draw_asm.o ../../Pico/draw2_asm.o
|
||||
endif
|
||||
ifeq "$(asm_memory)" "1"
|
||||
DEFINC += -D_ASM_MEMORY_C
|
||||
OBJS += ../../Pico/memory_asm.o
|
||||
endif
|
||||
ifeq "$(asm_ym2612)" "1"
|
||||
DEFINC += -D_ASM_YM2612_C
|
||||
OBJS += ../../Pico/sound/ym2612_asm.o
|
||||
endif
|
||||
ifeq "$(asm_misc)" "1"
|
||||
DEFINC += -D_ASM_MISC_C
|
||||
OBJS += ../../Pico/misc_asm.o
|
||||
OBJS += ../../Pico/cd/misc_asm.o
|
||||
endif
|
||||
ifeq "$(asm_cdpico)" "1"
|
||||
DEFINC += -D_ASM_CD_PICO_C
|
||||
OBJS += ../../Pico/cd/pico_asm.o
|
||||
endif
|
||||
ifeq "$(asm_cdmemory)" "1"
|
||||
DEFINC += -D_ASM_CD_MEMORY_C
|
||||
OBJS += ../../Pico/cd/memory_asm.o
|
||||
endif
|
||||
|
||||
# Pico - sound
|
||||
ifneq "$(amalgamate)" "1"
|
||||
OBJS += ../../Pico/sound/sound.o
|
||||
endif
|
||||
OBJS += ../../Pico/sound/mix_asm.o
|
||||
OBJS += ../../Pico/sound/sn76496.o ../../Pico/sound/ym2612.o
|
||||
# zlib
|
||||
OBJS += ../../zlib/gzio.o ../../zlib/inffast.o ../../zlib/inflate.o ../../zlib/inftrees.o ../../zlib/trees.o \
|
||||
../../zlib/deflate.o ../../zlib/crc32.o ../../zlib/adler32.o ../../zlib/zutil.o ../../zlib/compress.o
|
||||
# unzip
|
||||
OBJS += ../../unzip/unzip.o ../../unzip/unzip_stream.o
|
||||
# mp3
|
||||
OBJS += mp3.o
|
||||
# CPU cores
|
||||
# Cyclone
|
||||
DEFINC += -DEMU_C68K
|
||||
OBJS += ../../cpu/Cyclone/proj/Cyclone.o
|
||||
# drz80
|
||||
DEFINC += -D_USE_DRZ80
|
||||
OBJS += ../../cpu/DrZ80/drz80.o
|
||||
|
||||
|
||||
all: PicoDrive.exe
|
||||
|
||||
PicoDrive.exe : $(OBJS)
|
||||
@echo $@
|
||||
@$(GCC) -o $@ $(COPT) $^ -lm -lpng -Lkgsdk/ -lKGSDK -Wl,-Map=PicoDrive.map
|
||||
ifeq ($(DEBUG),)
|
||||
@$(STRIP) $@
|
||||
endif
|
||||
|
||||
|
||||
.c.o:
|
||||
@echo $<
|
||||
@$(GCC) $(COPT) $(DEFINC) -c $< -o $@
|
||||
#.s.o:
|
||||
# @echo $<
|
||||
# $(GCC) $(COPT) $(DEFINC) -c $< -o $@
|
||||
|
||||
../../Pico/draw_asm.o : ../../Pico/Draw.s
|
||||
@echo $<
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
../../Pico/draw2_asm.o : ../../Pico/Draw2.s
|
||||
@echo $<
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
../../Pico/memory_asm.o : ../../Pico/Memory.s
|
||||
@echo $<
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
../../Pico/sound/ym2612_asm.o : ../../Pico/sound/ym2612.s
|
||||
@echo $<
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
../../Pico/sound/mix_asm.o : ../../Pico/sound/mix.s
|
||||
@echo $<
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
../../Pico/misc_asm.o : ../../Pico/misc.s
|
||||
@echo $<
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
../../Pico/cd/pico_asm.o : ../../Pico/cd/Pico.s
|
||||
@echo $<
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
../../Pico/cd/memory_asm.o : ../../Pico/cd/Memory.s
|
||||
@echo $<
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
../../Pico/cd/misc_asm.o : ../../Pico/cd/misc.s
|
||||
@echo $<
|
||||
@$(AS) $(ASFLAGS) $< -o $@
|
||||
|
||||
# build Cyclone
|
||||
../../cpu/Cyclone/proj/Cyclone.s :
|
||||
@echo building Cyclone...
|
||||
@make -C ../../cpu/Cyclone/proj CONFIG_FILE=config_pico.h
|
||||
|
||||
|
||||
|
||||
# cleanup
|
||||
clean: tidy
|
||||
@$(RM) PicoDrive.exe
|
||||
tidy:
|
||||
@$(RM) $(OBJS)
|
||||
|
||||
|
||||
clean_prof:
|
||||
find ../.. -name '*.gcno' -delete
|
||||
find ../.. -name '*.gcda' -delete
|
||||
|
||||
# ----------- release -----------
|
||||
ifneq ($(findstring rel,$(MAKECMDGOALS)),)
|
||||
ifeq ($(VER),)
|
||||
$(error need VER)
|
||||
endif
|
||||
endif
|
||||
|
||||
rel: PicoDrive.exe kgsdk/ARMV4IRel/KGSDK.dll ../readme.txt config.txt
|
||||
zip -9 -j ../../PicoDrive_$(VER).zip $^
|
||||
zip -9 -r ../../PicoDrive_$(VER).zip skin -i \*.png -i \*.txt
|
||||
|
33
platform/gizmondo/emu.c
Normal file
33
platform/gizmondo/emu.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include <windows.h>
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
char romFileName[MAX_PATH];
|
||||
int engineState;
|
||||
currentConfig_t currentConfig;
|
||||
|
||||
unsigned char *rom_data = NULL;
|
||||
unsigned char *PicoDraw2FB = NULL; // temporary buffer for alt renderer
|
||||
int state_slot = 0;
|
||||
int reset_timing = 0;
|
||||
int config_slot = 0, config_slot_current = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
int emu_ReloadRom(void){}
|
||||
void emu_Init(void){}
|
||||
void emu_Deinit(void){}
|
||||
int emu_SaveLoadGame(int load, int sram){}
|
||||
void emu_Loop(void){}
|
||||
void emu_ResetGame(void){}
|
||||
int emu_ReadConfig(int game, int no_defaults){}
|
||||
int emu_WriteConfig(int game){}
|
||||
char *emu_GetSaveFName(int load, int is_sram, int slot){}
|
||||
int emu_check_save_file(int slot){}
|
||||
void emu_set_save_cbs(int gz){}
|
||||
void emu_forced_frame(void){}
|
||||
int emu_cd_check(char **bios_file){}
|
||||
int find_bios(int region, char **bios_file){}
|
||||
void scaling_update(void){}
|
||||
|
59
platform/gizmondo/emu.h
Normal file
59
platform/gizmondo/emu.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
// (c) Copyright 2006-2007 notaz, All rights reserved.
|
||||
// Free for non-commercial use.
|
||||
|
||||
// For commercial use, separate licencing terms must be obtained.
|
||||
|
||||
|
||||
|
||||
// engine states
|
||||
enum TPicoGameState {
|
||||
PGS_Paused = 1,
|
||||
PGS_Running,
|
||||
PGS_Quit,
|
||||
PGS_KeyConfig,
|
||||
PGS_ReloadRom,
|
||||
PGS_Menu,
|
||||
PGS_RestartRun,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char lastRomFile[512];
|
||||
int EmuOpt; // LSb->MSb: use_sram, show_fps, enable_sound, gzip_saves,
|
||||
// <reserved>, no_save_cfg_on_exit, <unused>, 16_bit_mode
|
||||
// <reserved>, confirm_save, show_cd_leds, confirm_load
|
||||
// <reserved>, <reserved>
|
||||
int PicoOpt; // used for config saving only, see Pico.h
|
||||
int PsndRate; // ditto
|
||||
int PicoRegion; // ditto
|
||||
int Frameskip;
|
||||
int CPUclock; // unused, placeholder for config compatibility
|
||||
int KeyBinds[32];
|
||||
int volume;
|
||||
int gamma; // unused
|
||||
int JoyBinds[4][32]; // unused
|
||||
int PicoAutoRgnOrder;
|
||||
int PicoCDBuffers;
|
||||
int scaling; // unused
|
||||
} currentConfig_t;
|
||||
|
||||
extern char romFileName[];
|
||||
extern int engineState;
|
||||
extern currentConfig_t currentConfig;
|
||||
|
||||
|
||||
int emu_ReloadRom(void);
|
||||
void emu_Init(void);
|
||||
void emu_Deinit(void);
|
||||
int emu_SaveLoadGame(int load, int sram);
|
||||
void emu_Loop(void);
|
||||
void emu_ResetGame(void);
|
||||
int emu_ReadConfig(int game, int no_defaults);
|
||||
int emu_WriteConfig(int game);
|
||||
char *emu_GetSaveFName(int load, int is_sram, int slot);
|
||||
int emu_check_save_file(int slot);
|
||||
void emu_set_save_cbs(int gz);
|
||||
void emu_forced_frame(void);
|
||||
int emu_cd_check(char **bios_file);
|
||||
int find_bios(int region, char **bios_file);
|
||||
void scaling_update(void);
|
||||
|
72
platform/gizmondo/giz.c
Normal file
72
platform/gizmondo/giz.c
Normal file
|
@ -0,0 +1,72 @@
|
|||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <version.h>
|
||||
|
||||
#include "giz.h"
|
||||
#include "kgsdk/Framework.h"
|
||||
#include "kgsdk/Framework2D.h"
|
||||
|
||||
#define LOG_FILE "log.log"
|
||||
|
||||
void *giz_screen = NULL;
|
||||
static FILE *logf = NULL;
|
||||
|
||||
void lprintf_al(const char *fmt, ...)
|
||||
{
|
||||
va_list vl;
|
||||
|
||||
if (logf == NULL)
|
||||
{
|
||||
logf = fopen(LOG_FILE, "w");
|
||||
if (logf == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
//if (strchr(fmt, '\n'))
|
||||
// fprintf(logf, "%lu: ", GetTickCount());
|
||||
va_start(vl, fmt);
|
||||
vfprintf(logf, fmt, vl);
|
||||
va_end(vl);
|
||||
fflush(logf);
|
||||
}
|
||||
|
||||
static void giz_log_close(void)
|
||||
{
|
||||
if (logf != NULL)
|
||||
{
|
||||
fclose(logf);
|
||||
logf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void giz_init(HINSTANCE hInstance, HINSTANCE hPrevInstance)
|
||||
{
|
||||
int ret;
|
||||
|
||||
giz_screen = NULL;
|
||||
|
||||
lprintf("PicoDrive v" VERSION " (c) notaz, 2006,2007\n");
|
||||
lprintf("%s %s\n\n", __DATE__, __TIME__);
|
||||
|
||||
ret = Framework_Init(hInstance, hPrevInstance);
|
||||
if (!ret)
|
||||
{
|
||||
lprintf_al("Framework_Init() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
ret = Framework2D_Init();
|
||||
if (!ret)
|
||||
{
|
||||
lprintf_al("Framework2D_Init() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
void giz_deinit(void)
|
||||
{
|
||||
Framework2D_Close();
|
||||
Framework_Close();
|
||||
|
||||
giz_log_close();
|
||||
}
|
||||
|
22
platform/gizmondo/giz.h
Normal file
22
platform/gizmondo/giz.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
extern void *giz_screen;
|
||||
|
||||
void giz_init();
|
||||
void giz_deinit(void);
|
||||
void lprintf_al(const char *fmt, ...);
|
||||
|
||||
#define lprintf lprintf_al
|
||||
|
||||
// button mappings, include kgsdk/Framework.h to use
|
||||
#define BTN_LEFT (1 << FRAMEWORK_BUTTON_DPAD_LEFT)
|
||||
#define BTN_RIGHT (1 << FRAMEWORK_BUTTON_DPAD_RIGHT)
|
||||
#define BTN_UP (1 << FRAMEWORK_BUTTON_DPAD_UP)
|
||||
#define BTN_DOWN (1 << FRAMEWORK_BUTTON_DPAD_DOWN)
|
||||
#define BTN_STOP (1 << FRAMEWORK_BUTTON_STOP)
|
||||
#define BTN_PLAY (1 << FRAMEWORK_BUTTON_PLAY)
|
||||
#define BTN_FWD (1 << FRAMEWORK_BUTTON_FORWARD)
|
||||
#define BTN_REW (1 << FRAMEWORK_BUTTON_REWIND)
|
||||
#define BTN_L (1 << FRAMEWORK_BUTTON_LEFT_SHOULDER)
|
||||
#define BTN_R (1 << FRAMEWORK_BUTTON_RIGHT_SHOULDER)
|
||||
#define BTN_HOME (1 << FRAMEWORK_BUTTON_HOME)
|
||||
|
||||
|
63
platform/gizmondo/main.c
Normal file
63
platform/gizmondo/main.c
Normal file
|
@ -0,0 +1,63 @@
|
|||
// (c) Copyright 2006 notaz, All rights reserved.
|
||||
// Free for non-commercial use.
|
||||
|
||||
// For commercial use, separate licencing terms must be obtained.
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "giz.h"
|
||||
#include "menu.h"
|
||||
#include "../common/menu.h"
|
||||
#include "emu.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
|
||||
{
|
||||
emu_ReadConfig(0, 0);
|
||||
giz_init(hInstance, hPrevInstance);
|
||||
emu_Init();
|
||||
menu_init();
|
||||
|
||||
engineState = PGS_Menu;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
switch (engineState)
|
||||
{
|
||||
case PGS_Menu:
|
||||
menu_loop();
|
||||
break;
|
||||
|
||||
case PGS_ReloadRom:
|
||||
if (emu_ReloadRom())
|
||||
engineState = PGS_Running;
|
||||
else {
|
||||
lprintf("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:
|
||||
lprintf("engine got into unknown state (%i), exitting\n", engineState);
|
||||
goto endloop;
|
||||
}
|
||||
}
|
||||
|
||||
endloop:
|
||||
|
||||
emu_Deinit();
|
||||
giz_deinit();
|
||||
|
||||
return 0;
|
||||
}
|
1532
platform/gizmondo/menu.c
Normal file
1532
platform/gizmondo/menu.c
Normal file
File diff suppressed because it is too large
Load diff
19
platform/gizmondo/menu.h
Normal file
19
platform/gizmondo/menu.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
// (c) Copyright 2006,2007 notaz, All rights reserved.
|
||||
// Free for non-commercial use.
|
||||
|
||||
// For commercial use, separate licencing terms must be obtained.
|
||||
|
||||
extern char menuErrorMsg[40];
|
||||
|
||||
void menu_init(void);
|
||||
void text_out16(int x, int y, const char *texto, ...);
|
||||
void menu_loop(void);
|
||||
int menu_loop_tray(void);
|
||||
void menu_romload_prepare(const char *rom_name);
|
||||
void menu_romload_end(void);
|
||||
|
||||
// TODO: add more?
|
||||
#define CONFIGURABLE_KEYS \
|
||||
(BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT|BTN_STOP|BTN_PLAY|BTN_FWD|BTN_REW| \
|
||||
BTN_L|BTN_R)
|
||||
|
8
platform/gizmondo/mp3.c
Normal file
8
platform/gizmondo/mp3.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int mp3_get_bitrate(FILE *f, int size){}
|
||||
void mp3_start_play(FILE *f, int pos){}
|
||||
int mp3_get_offset(void){} // 0-1023
|
||||
void mp3_update(int *buffer, int length, int stereo){}
|
||||
|
||||
|
18
platform/gizmondo/port_config.h
Normal file
18
platform/gizmondo/port_config.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
// port specific settings
|
||||
|
||||
#ifndef PORT_CONFIG_H
|
||||
#define PORT_CONFIG_H
|
||||
|
||||
#define CPU_CALL
|
||||
|
||||
// draw2.c
|
||||
#define START_ROW 0 // which row of tiles to start rendering at?
|
||||
#define END_ROW 28 // ..end
|
||||
|
||||
// pico.c
|
||||
#define CAN_HANDLE_240_LINES 1
|
||||
|
||||
//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)
|
||||
#define dprintf(x...)
|
||||
|
||||
#endif //PORT_CONFIG_H
|
10
platform/gizmondo/port_config.s
Normal file
10
platform/gizmondo/port_config.s
Normal file
|
@ -0,0 +1,10 @@
|
|||
@ vim:filetype=armasm
|
||||
|
||||
@ .equiv START_ROW, 1
|
||||
@ .equiv END_ROW, 27
|
||||
@ one row means 8 pixels. If above example was used, (27-1)*8=208 lines would be rendered.
|
||||
.equiv START_ROW, 0
|
||||
.equiv END_ROW, 28
|
||||
|
||||
@ this should be set to one only for GP2X port
|
||||
.equiv EXTERNAL_YM2612, 0
|
2
platform/gizmondo/version.h
Normal file
2
platform/gizmondo/version.h
Normal file
|
@ -0,0 +1,2 @@
|
|||
#define VERSION "1.33"
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue