mirror of
https://github.com/Oibaf66/fbzx-wii.git
synced 2024-11-24 17:16:57 +01:00
Joypad as joystick as default, FBZX Wii for Window can be installed everywhere
This commit is contained in:
parent
24c37cf1ac
commit
f931efe19e
@ -29,6 +29,7 @@
|
||||
#include "computer.h"
|
||||
#include "VirtualKeyboard.h"
|
||||
#include "menu_sdl.h"
|
||||
#include "emulator.h"
|
||||
#include<SDL/SDL_image.h>
|
||||
|
||||
#ifdef GEKKO
|
||||
@ -73,35 +74,46 @@ void VirtualKeyboard_init(SDL_Surface *screen)
|
||||
VirtualKeyboard.sel_x = 64;
|
||||
VirtualKeyboard.sel_y = 100;
|
||||
vkb_is_init = -1;
|
||||
char *image_path;
|
||||
|
||||
tmp_surface=IMG_Load("/fbzx-wii/fbzx/Spectrum_keyboard.png");
|
||||
image_path=myfile("fbzx/Spectrum_keyboard.png");
|
||||
tmp_surface=IMG_Load(image_path);
|
||||
free(image_path);
|
||||
if (tmp_surface == NULL) {printf("Impossible to load keyboard image\n"); return;}
|
||||
image_kbd=SDL_DisplayFormat(tmp_surface);
|
||||
SDL_FreeSurface (tmp_surface);
|
||||
|
||||
|
||||
tmp_surface=IMG_Load("/fbzx-wii/fbzx/symbol_shift.png");
|
||||
image_path=myfile("fbzx/symbol_shift.png");
|
||||
tmp_surface=IMG_Load(image_path);
|
||||
free(image_path);
|
||||
if (tmp_surface == NULL) {printf("Impossible to load symbol shift image\n"); return;}
|
||||
image_sym=SDL_DisplayFormat(tmp_surface);
|
||||
SDL_FreeSurface (tmp_surface);
|
||||
|
||||
|
||||
tmp_surface=IMG_Load("/fbzx-wii/fbzx/caps_shift.png");
|
||||
image_path=myfile("fbzx/caps_shift.png");
|
||||
tmp_surface=IMG_Load(image_path);
|
||||
free(image_path);
|
||||
if (tmp_surface == NULL) {printf("Impossible to load caps shift image\n"); return;}
|
||||
image_caps=SDL_DisplayFormat(tmp_surface);
|
||||
SDL_FreeSurface (tmp_surface);
|
||||
|
||||
tmp_surface=IMG_Load("/fbzx-wii/fbzx/Spectrum_keyboard_small.png");
|
||||
image_path=myfile("fbzx/Spectrum_keyboard_small.png");
|
||||
tmp_surface=IMG_Load(image_path);
|
||||
free(image_path);
|
||||
if (tmp_surface == NULL) {printf("Impossible to load keyboard small image\n"); return;}
|
||||
image_kbd_small=SDL_DisplayFormat(tmp_surface);
|
||||
SDL_FreeSurface (tmp_surface);
|
||||
|
||||
tmp_surface=IMG_Load("/fbzx-wii/fbzx/symbol_shift_small.png");
|
||||
image_path=myfile("fbzx/symbol_shift_small.png");
|
||||
tmp_surface=IMG_Load(image_path);
|
||||
free(image_path);
|
||||
if (tmp_surface == NULL) {printf("Impossible to load symbol shift small image\n"); return;}
|
||||
image_sym_small=SDL_DisplayFormat(tmp_surface);
|
||||
SDL_FreeSurface (tmp_surface);
|
||||
|
||||
tmp_surface=IMG_Load("/fbzx-wii/fbzx/caps_shift_small.png");
|
||||
image_path=myfile("fbzx/caps_shift_small.png");
|
||||
tmp_surface=IMG_Load(image_path);
|
||||
free(image_path);
|
||||
if (tmp_surface == NULL) {printf("Impossible to load caps shift small image\n"); return;}
|
||||
image_caps_small=SDL_DisplayFormat(tmp_surface);
|
||||
SDL_FreeSurface (tmp_surface);
|
||||
|
@ -99,6 +99,8 @@ void computer_init () { //Called only on start-up
|
||||
ordenador.videosystem = 0; //PAL
|
||||
ordenador.joystick[0] = 1; //Kemposton
|
||||
ordenador.joystick[1] = 0; // Cursor
|
||||
ordenador.joypad_as_joystick[0]= 1;
|
||||
ordenador.joypad_as_joystick[1]= 1;
|
||||
ordenador.vk_auto = 0; //Vk called by +
|
||||
ordenador.vk_rumble = 1; //enabled
|
||||
ordenador.rumble[0] = 0;
|
||||
|
@ -242,7 +242,12 @@ unsigned char InitNetwork()
|
||||
int load_zxspectrum_picture()
|
||||
{
|
||||
|
||||
image=IMG_Load("/fbzx-wii/fbzx/ZXSpectrum48k.png");
|
||||
char *image_path;
|
||||
|
||||
image_path=myfile("fbzx/ZXSpectrum48k.png");
|
||||
|
||||
image=IMG_Load(image_path);
|
||||
free(image_path);
|
||||
|
||||
if (image == NULL) {printf("Impossible to load image\n"); return 0;}
|
||||
|
||||
@ -307,25 +312,17 @@ void SDL_Fullscreen_Switch()
|
||||
|
||||
FILE *myfopen(char *filename,char *mode) {
|
||||
|
||||
char tmp[4096];
|
||||
char path[MAX_PATH_LENGTH];
|
||||
FILE *fichero;
|
||||
int length;
|
||||
|
||||
fichero=fopen(filename,mode);
|
||||
if (fichero!=NULL) {
|
||||
return (fichero);
|
||||
}
|
||||
sprintf(tmp,"/usr/share/%s",filename);
|
||||
fichero=fopen(tmp,mode);
|
||||
if (fichero!=NULL) {
|
||||
return (fichero);
|
||||
}
|
||||
sprintf(tmp,"/usr/local/share/%s",filename);
|
||||
fichero=fopen(tmp,mode);
|
||||
if (fichero!=NULL) {
|
||||
return (fichero);
|
||||
}
|
||||
sprintf(tmp,"/fbzx-wii/%s",filename);
|
||||
fichero=fopen(tmp,mode);
|
||||
strcpy(path,getenv("HOME"));
|
||||
length=strlen(path);
|
||||
if ((length>0)&&(path[length-1]!='/'))
|
||||
strcat(path,"/");
|
||||
strcat(path,filename);
|
||||
printf("opening %s\n",path);
|
||||
fichero=fopen(path,mode);
|
||||
if (fichero!=NULL) {
|
||||
return (fichero);
|
||||
}
|
||||
@ -333,6 +330,22 @@ FILE *myfopen(char *filename,char *mode) {
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
char *myfile(char *filename) {
|
||||
|
||||
char *path;
|
||||
int length;
|
||||
|
||||
path=(char *)malloc(MAX_PATH_LENGTH);
|
||||
|
||||
strcpy(path,getenv("HOME"));
|
||||
length=strlen(path);
|
||||
if ((length>0)&&(path[length-1]!='/'))
|
||||
strcat(path,"/");
|
||||
strcat(path,filename);
|
||||
|
||||
return (path);
|
||||
}
|
||||
|
||||
char *load_a_rom(char **filenames) {
|
||||
|
||||
char **pointer;
|
||||
@ -786,7 +799,7 @@ void load_config_network(struct computer *object) {
|
||||
unsigned char smb_enable=0, ftp_enable=0, FTPPassive=0;
|
||||
unsigned int FTPPort=21;
|
||||
|
||||
fconfig = fopen("/fbzx-wii/fbzx.net","rb");
|
||||
fconfig = myfopen("fbzx.net","rb");
|
||||
if (fconfig==NULL) {
|
||||
return;
|
||||
}
|
||||
@ -1190,7 +1203,16 @@ int main(int argc,char *argv[])
|
||||
#endif
|
||||
|
||||
#ifdef MINGW
|
||||
if(!getenv("HOME")) putenv("HOME=/fbzx-wii");
|
||||
char path_home[MAX_PATH_LENGTH];
|
||||
int i;
|
||||
strcpy(path_home,"HOME=");
|
||||
getcwd(path_home+5, MAX_PATH_LENGTH-5);
|
||||
|
||||
for (i=4; path_home[i]!=0;i++)
|
||||
if (path_home[i]=='\\') path_home[i]='/';
|
||||
|
||||
printf("%s\n",path_home);
|
||||
putenv(path_home);
|
||||
#endif
|
||||
|
||||
#ifdef GEKKO
|
||||
|
@ -56,6 +56,7 @@ int load_config(struct computer *object, char *filename);
|
||||
int save_config(struct computer *object, char *filename);
|
||||
int save_config_game(struct computer *object, char *filename, int overwrite);
|
||||
FILE *myfopen(char *filename,char *mode);
|
||||
char *myfile(char *filename);
|
||||
void init_sdl();
|
||||
void init_sound();
|
||||
void init_screen(int resx,int resy,int depth,int fullscreen,int dblbuffer,int hwsurface);
|
||||
|
@ -86,7 +86,6 @@ static SDL_Surface *real_screen;
|
||||
#define IS_SUBMENU(p_msg) ( (p_msg)[0] == '^' )
|
||||
#define IS_TEXT(p_msg) ( (p_msg)[0] == '#' || (p_msg)[0] == ' ' )
|
||||
#define IS_MARKER(p_msg) ( (p_msg)[0] == '@' )
|
||||
#define FONT_PATH "/fbzx-wii/fbzx/FreeMono.ttf"
|
||||
|
||||
static int is_inited = 0;
|
||||
static TTF_Font *menu_font16, *menu_font20, *menu_font8, *menu_font10;
|
||||
@ -1492,12 +1491,18 @@ static TTF_Font *read_font(const char *path, int font_size)
|
||||
|
||||
void font_init()
|
||||
{
|
||||
char *font_path;
|
||||
|
||||
TTF_Init();
|
||||
|
||||
font_path=myfile("fbzx/FreeMono.ttf");
|
||||
|
||||
menu_font16 = read_font(FONT_PATH, 16);
|
||||
menu_font20 = read_font(FONT_PATH, 20);
|
||||
menu_font8 = read_font(FONT_PATH, 8);
|
||||
menu_font10 = read_font(FONT_PATH, 10);
|
||||
menu_font16 = read_font(font_path, 16);
|
||||
menu_font20 = read_font(font_path, 20);
|
||||
menu_font8 = read_font(font_path, 8);
|
||||
menu_font10 = read_font(font_path, 10);
|
||||
|
||||
free(font_path);
|
||||
}
|
||||
|
||||
void menu_init(SDL_Surface *screen)
|
||||
|
Loading…
Reference in New Issue
Block a user