mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-26 21:44:22 +01:00
All stuff so far
This commit is contained in:
parent
e361a0f504
commit
e0e0d8ffc0
2
Makefile
2
Makefile
@ -33,7 +33,7 @@ LDFLAGS = -L$(DEVKITPRO)/SDL/lib -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -lSDL_ttf -lSDL_mixer -lSDL_image -ljpeg -lpng -lz -lSDL -lfreetype -lfat -lwiiuse -lbte -logc -lm
|
||||
LIBS := -lSDL_image -ljpeg -lpng -lz -lSDL -lfat -lwiiuse -lbte -logc -lm
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
|
@ -146,7 +146,6 @@ private:
|
||||
|
||||
#ifdef GEKKO
|
||||
double speed_index;
|
||||
int joystick_key_binding[5]; /* A, B, Plus, Minus, 1 */
|
||||
#endif
|
||||
|
||||
#ifdef __unix
|
||||
@ -167,8 +166,6 @@ public:
|
||||
void select_disc();
|
||||
void bind_key();
|
||||
void display_options();
|
||||
|
||||
int display_type;
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
|
@ -68,7 +68,7 @@ void C64::c64_ctor1(void)
|
||||
this->fake_key_keytime = 5;
|
||||
this->fake_key_type = 0;
|
||||
|
||||
this->menu_font = new Font("/apps/frodo/fonts.png");
|
||||
this->menu_font = new Font("/apps/frodo/fonts.bmp");
|
||||
if (!this->menu_font)
|
||||
{
|
||||
fprintf(stderr, "Unable to open font\n" );
|
||||
@ -195,7 +195,7 @@ void C64::bind_key()
|
||||
int key = menu_select(screen, &key_menu, ~0, NULL);
|
||||
|
||||
#if defined(GEKKO)
|
||||
this->joystick_key_binding[opt] = kcs[key];
|
||||
ThePrefs.JoystickKeyBinding[opt] = kcs[key];
|
||||
#endif
|
||||
}
|
||||
menu_fini(&bind_key_menu);
|
||||
@ -210,7 +210,7 @@ void C64::display_options()
|
||||
0, 0, DISPLAY_X, DISPLAY_Y);
|
||||
int opt = menu_select(screen, &display_menu, ~0, NULL);
|
||||
if (opt >= 0)
|
||||
this->display_type = opt;
|
||||
ThePrefs.DisplayOption = opt;
|
||||
menu_fini(&display_menu);
|
||||
}
|
||||
|
||||
@ -372,21 +372,23 @@ uint8 C64::poll_joystick(int port)
|
||||
j &= 0xef; // Button
|
||||
if (held & WPAD_BUTTON_HOME)
|
||||
this->enter_menu();
|
||||
if (held & WPAD_BUTTON_A)
|
||||
exit(1);
|
||||
|
||||
if ( (held & WPAD_BUTTON_A) && this->joystick_key_binding[0])
|
||||
TheDisplay->FakeKeyPress(this->joystick_key_binding[0],
|
||||
if ( (held & WPAD_BUTTON_A) && ThePrefs.JoystickKeyBinding[0])
|
||||
TheDisplay->FakeKeyPress(ThePrefs.JoystickKeyBinding[0],
|
||||
false, TheCIA1->KeyMatrix, TheCIA1->RevMatrix, NULL);
|
||||
if ( (held & WPAD_BUTTON_B) && this->joystick_key_binding[1])
|
||||
TheDisplay->FakeKeyPress(this->joystick_key_binding[1],
|
||||
if ( (held & WPAD_BUTTON_B) && ThePrefs.JoystickKeyBinding[1])
|
||||
TheDisplay->FakeKeyPress(ThePrefs.JoystickKeyBinding[1],
|
||||
false, TheCIA1->KeyMatrix, TheCIA1->RevMatrix, NULL);
|
||||
if ( (held & WPAD_BUTTON_PLUS) && this->joystick_key_binding[2])
|
||||
TheDisplay->FakeKeyPress(this->joystick_key_binding[2],
|
||||
if ( (held & WPAD_BUTTON_PLUS) && ThePrefs.JoystickKeyBinding[2])
|
||||
TheDisplay->FakeKeyPress(ThePrefs.JoystickKeyBinding[2],
|
||||
false, TheCIA1->KeyMatrix, TheCIA1->RevMatrix, NULL);
|
||||
if ( (held & WPAD_BUTTON_MINUS) && this->joystick_key_binding[3])
|
||||
TheDisplay->FakeKeyPress(this->joystick_key_binding[3],
|
||||
if ( (held & WPAD_BUTTON_MINUS) && ThePrefs.JoystickKeyBinding[3])
|
||||
TheDisplay->FakeKeyPress(ThePrefs.JoystickKeyBinding[3],
|
||||
false, TheCIA1->KeyMatrix, TheCIA1->RevMatrix, NULL);
|
||||
if ( (held & WPAD_BUTTON_1) && this->joystick_key_binding[4])
|
||||
TheDisplay->FakeKeyPress(this->joystick_key_binding[4],
|
||||
if ( (held & WPAD_BUTTON_1) && ThePrefs.JoystickKeyBinding[4])
|
||||
TheDisplay->FakeKeyPress(ThePrefs.JoystickKeyBinding[4],
|
||||
false, TheCIA1->KeyMatrix, TheCIA1->RevMatrix, NULL);
|
||||
|
||||
|
||||
|
@ -111,7 +111,6 @@ C64Display::C64Display(C64 *the_c64) : TheC64(the_c64)
|
||||
C64Display::~C64Display()
|
||||
{
|
||||
SDL_Quit();
|
||||
TTF_Quit();
|
||||
}
|
||||
|
||||
|
||||
@ -404,6 +403,8 @@ static void translate_key(SDLKey key, bool key_up, uint8 *key_matrix, uint8 *rev
|
||||
|
||||
case SDLK_KP_DIVIDE: c64_key = MATRIX(6,7); break;
|
||||
case SDLK_KP_ENTER: c64_key = MATRIX(0,1); break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (c64_key < 0)
|
||||
|
@ -78,6 +78,9 @@ Prefs::Prefs()
|
||||
this->JoystickKeyBinding[1] = 0;
|
||||
this->JoystickKeyBinding[2] = 0;
|
||||
this->JoystickKeyBinding[3] = 0;
|
||||
this->JoystickKeyBinding[4] = 0;
|
||||
|
||||
this->DisplayOption = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -138,6 +141,8 @@ bool Prefs::operator==(const Prefs &rhs) const
|
||||
&& this->JoystickKeyBinding[1] == rhs.JoystickKeyBinding[1]
|
||||
&& this->JoystickKeyBinding[2] == rhs.JoystickKeyBinding[2]
|
||||
&& this->JoystickKeyBinding[3] == rhs.JoystickKeyBinding[3]
|
||||
&& this->JoystickKeyBinding[4] == rhs.JoystickKeyBinding[4]
|
||||
&& this->DisplayOption == rhs.DisplayOption
|
||||
#endif
|
||||
);
|
||||
}
|
||||
@ -312,6 +317,10 @@ void Prefs::Load(char *filename)
|
||||
JoystickKeyBinding[2] = atoi(value);
|
||||
else if (!strcmp(keyword, "JoystickKeyBinding3"))
|
||||
JoystickKeyBinding[3] = atoi(value);
|
||||
else if (!strcmp(keyword, "JoystickKeyBinding4"))
|
||||
JoystickKeyBinding[4] = atoi(value);
|
||||
else if (!strcmp(keyword, "DisplayOption"))
|
||||
DisplayOption = atoi(value);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -414,6 +423,9 @@ bool Prefs::Save(char *filename)
|
||||
fprintf(file, "JoystickKeyBinding1 = %d\n", JoystickKeyBinding[1]);
|
||||
fprintf(file, "JoystickKeyBinding2 = %d\n", JoystickKeyBinding[2]);
|
||||
fprintf(file, "JoystickKeyBinding3 = %d\n", JoystickKeyBinding[3]);
|
||||
fprintf(file, "JoystickKeyBinding4 = %d\n", JoystickKeyBinding[4]);
|
||||
|
||||
fprintf(file, "DisplayOption = %d\n", DisplayOption);
|
||||
#endif
|
||||
fclose(file);
|
||||
ThePrefsOnDisk = *this;
|
||||
|
@ -116,7 +116,8 @@ private:
|
||||
#endif
|
||||
|
||||
#ifdef GEKKO
|
||||
int JoystickKeyBinding[4];
|
||||
int JoystickKeyBinding[5];
|
||||
int DisplayOption;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -1,11 +1,42 @@
|
||||
#include <SDL_image.h>
|
||||
#include <SDL.h>
|
||||
#include <SDL_rwops.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "bitmap-font.h"
|
||||
|
||||
Font::Font(std::string src_file)
|
||||
{
|
||||
m_pFontList = SDL_DisplayFormatAlpha(IMG_Load(src_file.c_str()));
|
||||
Uint8 *data = (Uint8*)malloc(2 * 1024*1024);
|
||||
FILE *fp = fopen(src_file.c_str(), "r");
|
||||
SDL_RWops *rw;
|
||||
|
||||
if (!fp) {
|
||||
fprintf(stderr, "Could not open fonts\n");
|
||||
SDL_Delay(1000);
|
||||
free(data);
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "I could open fonts manually\n");
|
||||
fread(data, 1, 2 * 1024 * 1024, fp);
|
||||
rw = SDL_RWFromMem(data, 2 * 1024 * 1024);
|
||||
if (!rw) {
|
||||
fprintf(stderr, "Could not create RW: %s\n", SDL_GetError());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
SDL_Surface *surf = IMG_Load_RW(rw, 0);
|
||||
|
||||
if (!surf) {
|
||||
fprintf(stderr, "Could not load %s\n", src_file.c_str());
|
||||
SDL_Delay(1000);
|
||||
exit(1);
|
||||
}
|
||||
m_pFontList = surf;
|
||||
|
||||
SDL_FreeRW(rw);
|
||||
free(data);
|
||||
}
|
||||
|
||||
Font::~Font(void)
|
||||
|
@ -33,19 +33,13 @@ extern "C" int main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
fflush(stdout);
|
||||
fatInitDefault();
|
||||
|
||||
// Init SDL
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
|
||||
fprintf(stderr, "Couldn't initialize SDL (%s)\n", SDL_GetError());
|
||||
return 0;
|
||||
}
|
||||
if (TTF_Init() < 0)
|
||||
{
|
||||
fprintf(stderr, "Unable to init TTF: %s\n", TTF_GetError() );
|
||||
return 0;
|
||||
}
|
||||
|
||||
fatInitDefault();
|
||||
if (WPAD_Init() != WPAD_ERR_NONE)
|
||||
{
|
||||
fprintf(stderr, "Failed initializing controllers\n");
|
||||
|
Loading…
Reference in New Issue
Block a user