mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-26 13:34:22 +01:00
Enough to compile
This commit is contained in:
parent
e0a34d4066
commit
b9ba2096fd
11
Makefile
11
Makefile
@ -25,7 +25,7 @@ INCLUDES :=
|
|||||||
# options for code generation
|
# options for code generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) -I$(DEVKITPRO)/SDL/include -U__unix
|
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) -I$(DEVKITPRO)/SDL/include -U__unix -DHAVE_SDL
|
||||||
CXXFLAGS = $(CFLAGS)
|
CXXFLAGS = $(CFLAGS)
|
||||||
|
|
||||||
LDFLAGS = -L$(DEVKITPRO)/SDL/lib -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
LDFLAGS = -L$(DEVKITPRO)/SDL/lib -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
||||||
@ -58,7 +58,7 @@ export DEPSDIR := $(CURDIR)/$(BUILD)
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# automatically build a list of object files for our project
|
# automatically build a list of object files for our project
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
CFILES :=
|
CFILES := menu.c char_to_kc.c
|
||||||
CPPFILES := Display.cpp main.cpp Prefs.cpp SID.cpp REU.cpp IEC.cpp 1541fs.cpp \
|
CPPFILES := Display.cpp main.cpp Prefs.cpp SID.cpp REU.cpp IEC.cpp 1541fs.cpp \
|
||||||
1541d64.cpp 1541t64.cpp 1541job.o SAM.cpp C64.cpp CPUC64.cpp VIC.cpp \
|
1541d64.cpp 1541t64.cpp 1541job.o SAM.cpp C64.cpp CPUC64.cpp VIC.cpp \
|
||||||
CIA.cpp CPU1541.cpp
|
CIA.cpp CPU1541.cpp
|
||||||
@ -120,7 +120,7 @@ DEPENDS := $(OFILES:.o=.d)
|
|||||||
# main targets
|
# main targets
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
$(OUTPUT).dol: $(OUTPUT).elf
|
$(OUTPUT).dol: $(OUTPUT).elf
|
||||||
$(OUTPUT).elf: $(OFILES)
|
$(OUTPUT).elf: sysconfig.h $(OFILES)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# This rule links in binary data with the .jpg extension
|
# This rule links in binary data with the .jpg extension
|
||||||
@ -130,6 +130,11 @@ $(OUTPUT).elf: $(OFILES)
|
|||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
$(bin2o)
|
$(bin2o)
|
||||||
|
|
||||||
|
sysconfig.h: sysconfig.h.Wii
|
||||||
|
cp $< $@
|
||||||
|
|
||||||
|
Display.cpp: Display_SDL.i
|
||||||
|
|
||||||
-include $(DEPENDS)
|
-include $(DEPENDS)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
@ -712,8 +712,3 @@ bool C64::LoadSnapshot(char *filename)
|
|||||||
#ifdef __riscos__
|
#ifdef __riscos__
|
||||||
#include "C64_Acorn.i"
|
#include "C64_Acorn.i"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GEKKO
|
|
||||||
#include "C64_wii.i"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
|
#if defined(GEKKO)
|
||||||
|
#include <wiiuse/wpad.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static struct timeval tv_start;
|
static struct timeval tv_start;
|
||||||
static char *main_menu_messages[] = {
|
static char *main_menu_messages[] = {
|
||||||
@ -39,9 +42,11 @@ static char *bind_key_messages[] = {
|
|||||||
void C64::c64_ctor1(void)
|
void C64::c64_ctor1(void)
|
||||||
{
|
{
|
||||||
// Initialize joystick variables
|
// Initialize joystick variables
|
||||||
|
#ifdef HAVE_LINUX_JOYSTICK_H
|
||||||
joyfd[0] = joyfd[1] = -1;
|
joyfd[0] = joyfd[1] = -1;
|
||||||
joy_minx = joy_miny = 32767;
|
joy_minx = joy_miny = 32767;
|
||||||
joy_maxx = joy_maxy = -32768;
|
joy_maxx = joy_maxy = -32768;
|
||||||
|
#endif
|
||||||
|
|
||||||
this->base_dir = ".";
|
this->base_dir = ".";
|
||||||
|
|
||||||
@ -358,16 +363,16 @@ uint8 C64::poll_joystick(int port)
|
|||||||
this->enter_menu();
|
this->enter_menu();
|
||||||
if ( (held & WPAD_BUTTON_A) && this->joystick_key_binding[0])
|
if ( (held & WPAD_BUTTON_A) && this->joystick_key_binding[0])
|
||||||
TheDisplay->FakeKeyPress(this->joystick_key_binding[0],
|
TheDisplay->FakeKeyPress(this->joystick_key_binding[0],
|
||||||
shifted, TheCIA1->KeyMatrix, TheCIA1->RevMatrix, &joykey);
|
false, TheCIA1->KeyMatrix, TheCIA1->RevMatrix, NULL);
|
||||||
if ( (held & WPAD_BUTTON_PLUS) && this->joystick_key_binding[1])
|
if ( (held & WPAD_BUTTON_PLUS) && this->joystick_key_binding[1])
|
||||||
TheDisplay->FakeKeyPress(this->joystick_key_binding[1],
|
TheDisplay->FakeKeyPress(this->joystick_key_binding[1],
|
||||||
shifted, TheCIA1->KeyMatrix, TheCIA1->RevMatrix, &joykey);
|
false, TheCIA1->KeyMatrix, TheCIA1->RevMatrix, NULL);
|
||||||
if ( (held & WPAD_BUTTON_MINUS) && this->joystick_key_binding[2])
|
if ( (held & WPAD_BUTTON_MINUS) && this->joystick_key_binding[2])
|
||||||
TheDisplay->FakeKeyPress(this->joystick_key_binding[2],
|
TheDisplay->FakeKeyPress(this->joystick_key_binding[2],
|
||||||
shifted, TheCIA1->KeyMatrix, TheCIA1->RevMatrix, &joykey);
|
false, TheCIA1->KeyMatrix, TheCIA1->RevMatrix, NULL);
|
||||||
if ( (held & WPAD_BUTTON_1) && this->joystick_key_binding[1])
|
if ( (held & WPAD_BUTTON_1) && this->joystick_key_binding[1])
|
||||||
TheDisplay->FakeKeyPress(this->joystick_key_binding[1],
|
TheDisplay->FakeKeyPress(this->joystick_key_binding[1],
|
||||||
shifted, TheCIA1->KeyMatrix, TheCIA1->RevMatrix, &joykey);
|
false, TheCIA1->KeyMatrix, TheCIA1->RevMatrix, NULL);
|
||||||
|
|
||||||
|
|
||||||
return j;
|
return j;
|
||||||
|
@ -61,7 +61,7 @@ enum {
|
|||||||
int init_graphics(void)
|
int init_graphics(void)
|
||||||
{
|
{
|
||||||
// Init SDL
|
// Init SDL
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
|
||||||
fprintf(stderr, "Couldn't initialize SDL (%s)\n", SDL_GetError());
|
fprintf(stderr, "Couldn't initialize SDL (%s)\n", SDL_GetError());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -134,10 +134,10 @@ bool Prefs::operator==(const Prefs &rhs) const
|
|||||||
&& SystemKeys == rhs.SystemKeys
|
&& SystemKeys == rhs.SystemKeys
|
||||||
&& ShowLEDs == rhs.ShowLEDs
|
&& ShowLEDs == rhs.ShowLEDs
|
||||||
#ifdef GEKKO
|
#ifdef GEKKO
|
||||||
&& this->JoystickKeyBinding[0] == rhs.JoystickKeybinding[0]
|
&& this->JoystickKeyBinding[0] == rhs.JoystickKeyBinding[0]
|
||||||
&& this->JoystickKeyBinding[1] == rhs.JoystickKeybinding[1]
|
&& this->JoystickKeyBinding[1] == rhs.JoystickKeyBinding[1]
|
||||||
&& this->JoystickKeyBinding[2] == rhs.JoystickKeybinding[2]
|
&& this->JoystickKeyBinding[2] == rhs.JoystickKeyBinding[2]
|
||||||
&& this->JoystickKeyBinding[3] == rhs.JoystickKeybinding[3]
|
&& this->JoystickKeyBinding[3] == rhs.JoystickKeyBinding[3]
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
132
Src/SID_SDL.i
Normal file
132
Src/SID_SDL.i
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
/*
|
||||||
|
* SID_linux.i - 6581 emulation, Linux specific stuff
|
||||||
|
*
|
||||||
|
* Frodo (C) 1994-1997,2002 Christian Bauer
|
||||||
|
* Linux sound stuff by Bernd Schmidt
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <SDL.h>
|
||||||
|
#include <SDL_mixer.h>
|
||||||
|
|
||||||
|
#include "VIC.h"
|
||||||
|
|
||||||
|
static int divisor = 0;
|
||||||
|
static int to_output = 0;
|
||||||
|
static int buffer_pos = 0;
|
||||||
|
|
||||||
|
void DigitalRenderer::fill_audio(Uint8 *stream, int len)
|
||||||
|
{
|
||||||
|
int cnt = 0;
|
||||||
|
int bytes_to_write = to_output * sizeof(Uint16);
|
||||||
|
int buf_size = this->sndbufsize * sizeof(Uint16);
|
||||||
|
|
||||||
|
memset(stream, 0, len);
|
||||||
|
if (to_output <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
while (cnt < bytes_to_write && cnt < len)
|
||||||
|
{
|
||||||
|
int datalen = buf_size;
|
||||||
|
|
||||||
|
if (datalen > bytes_to_write)
|
||||||
|
datalen = bytes_to_write;
|
||||||
|
|
||||||
|
if (datalen > len - cnt)
|
||||||
|
datalen = len - cnt;
|
||||||
|
|
||||||
|
calc_buffer(sound_buffer, datalen);
|
||||||
|
memcpy(stream + cnt, (Uint8*)this->sound_buffer, datalen);
|
||||||
|
cnt += datalen;
|
||||||
|
}
|
||||||
|
if (to_output - cnt / 2 <= 0)
|
||||||
|
to_output = 0;
|
||||||
|
else
|
||||||
|
to_output -= cnt / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DigitalRenderer::fill_audio_helper(void *udata, Uint8 *stream, int len)
|
||||||
|
{
|
||||||
|
DigitalRenderer *p_this = (DigitalRenderer *)udata;
|
||||||
|
|
||||||
|
p_this->fill_audio(stream, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialization
|
||||||
|
*/
|
||||||
|
|
||||||
|
void DigitalRenderer::init_sound(void)
|
||||||
|
{
|
||||||
|
this->sndbufsize = 512;
|
||||||
|
|
||||||
|
/* Set the audio format */
|
||||||
|
this->spec.freq = 44100;
|
||||||
|
this->spec.format = AUDIO_S16LSB;
|
||||||
|
this->spec.channels = 1; /* 1 = mono, 2 = stereo */
|
||||||
|
this->spec.samples = 512;
|
||||||
|
this->spec.callback = this->fill_audio_helper;
|
||||||
|
this->spec.userdata = (void*)this;
|
||||||
|
|
||||||
|
ready = false;
|
||||||
|
if ( SDL_OpenAudio(&this->spec, NULL) < 0 ) {
|
||||||
|
fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->sound_buffer = new int16[this->sndbufsize];
|
||||||
|
ready = true;
|
||||||
|
SDL_PauseAudio(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Destructor
|
||||||
|
*/
|
||||||
|
|
||||||
|
DigitalRenderer::~DigitalRenderer()
|
||||||
|
{
|
||||||
|
SDL_CloseAudio();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pause sound output
|
||||||
|
*/
|
||||||
|
|
||||||
|
void DigitalRenderer::Pause(void)
|
||||||
|
{
|
||||||
|
SDL_PauseAudio(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Resume sound output
|
||||||
|
*/
|
||||||
|
|
||||||
|
void DigitalRenderer::Resume(void)
|
||||||
|
{
|
||||||
|
SDL_PauseAudio(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fill buffer, sample volume (for sampled voice)
|
||||||
|
*/
|
||||||
|
|
||||||
|
void DigitalRenderer::EmulateLine(void)
|
||||||
|
{
|
||||||
|
if (!ready)
|
||||||
|
return;
|
||||||
|
|
||||||
|
sample_buf[sample_in_ptr] = volume;
|
||||||
|
sample_in_ptr = (sample_in_ptr + 1) % SAMPLE_BUF_SIZE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Now see how many samples have to be added for this line
|
||||||
|
*/
|
||||||
|
divisor += SAMPLE_FREQ;
|
||||||
|
while (divisor >= 0)
|
||||||
|
divisor -= TOTAL_RASTERS*SCREEN_FREQ, to_output++;
|
||||||
|
}
|
@ -95,7 +95,7 @@
|
|||||||
#define HAVE_FCNTL_H 1
|
#define HAVE_FCNTL_H 1
|
||||||
|
|
||||||
/* Define if you have the <linux/joystick.h> header file. */
|
/* Define if you have the <linux/joystick.h> header file. */
|
||||||
/* #undef HAVE_LINUX_JOYSTICK_H */
|
#undef HAVE_LINUX_JOYSTICK_H
|
||||||
|
|
||||||
/* Define if you have the <ncurses.h> header file. */
|
/* Define if you have the <ncurses.h> header file. */
|
||||||
/* #undef HAVE_NCURSES_H */
|
/* #undef HAVE_NCURSES_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user