mirror of
https://github.com/Oibaf66/fbzx-wii.git
synced 2024-11-28 11:04:15 +01:00
Fixed freeing image surface and font at exit
This commit is contained in:
parent
1581b79cc7
commit
956c79e747
@ -124,6 +124,20 @@ void VirtualKeyboard_init(SDL_Surface *screen)
|
|||||||
vkb_is_init = 1;
|
vkb_is_init = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VirtualKeyboard_fini()
|
||||||
|
{
|
||||||
|
if (vkb_is_init != 1) return;
|
||||||
|
|
||||||
|
SDL_FreeSurface (image_kbd);
|
||||||
|
SDL_FreeSurface (image_sym);
|
||||||
|
SDL_FreeSurface (image_caps);
|
||||||
|
SDL_FreeSurface (image_kbd_small);
|
||||||
|
SDL_FreeSurface (image_sym_small);
|
||||||
|
SDL_FreeSurface (image_caps_small);
|
||||||
|
vkb_is_init = -1;
|
||||||
|
ordenador.vk_is_active=0;
|
||||||
|
}
|
||||||
|
|
||||||
void draw_vk()
|
void draw_vk()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -45,6 +45,7 @@ typedef struct Virtual_Keyboard
|
|||||||
} VirtualKeyboard_struct;
|
} VirtualKeyboard_struct;
|
||||||
|
|
||||||
void VirtualKeyboard_init(SDL_Surface *screen);
|
void VirtualKeyboard_init(SDL_Surface *screen);
|
||||||
|
void VirtualKeyboard_fini(void);
|
||||||
struct virtkey* get_key();
|
struct virtkey* get_key();
|
||||||
struct virtkey* get_key_internal();
|
struct virtkey* get_key_internal();
|
||||||
void draw_vk();
|
void draw_vk();
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "microdrive.h"
|
#include "microdrive.h"
|
||||||
#include "menu_sdl.h"
|
#include "menu_sdl.h"
|
||||||
#include "tape_browser.h"
|
#include "tape_browser.h"
|
||||||
|
#include "VirtualKeyboard.h"
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
|
|
||||||
@ -611,6 +612,9 @@ void end_system() {
|
|||||||
if(ordenador.tap_file!=NULL)
|
if(ordenador.tap_file!=NULL)
|
||||||
fclose(ordenador.tap_file);
|
fclose(ordenador.tap_file);
|
||||||
|
|
||||||
|
VirtualKeyboard_fini();
|
||||||
|
menu_deinit();
|
||||||
|
font_fini();
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
|
||||||
if (!chdir(path_tmp)) {chdir("/"); remove_dir(path_tmp);} //remove the tmp directory if it exists
|
if (!chdir(path_tmp)) {chdir("/"); remove_dir(path_tmp);} //remove the tmp directory if it exists
|
||||||
@ -1409,6 +1413,7 @@ int main(int argc,char *argv[])
|
|||||||
|
|
||||||
font_init();
|
font_init();
|
||||||
menu_init(ordenador.screen);
|
menu_init(ordenador.screen);
|
||||||
|
VirtualKeyboard_init(ordenador.screen);
|
||||||
|
|
||||||
//Load the splash screen
|
//Load the splash screen
|
||||||
if (ordenador.zaurus_mini==0) if (load_zxspectrum_picture()) SDL_FreeSurface (image);
|
if (ordenador.zaurus_mini==0) if (load_zxspectrum_picture()) SDL_FreeSurface (image);
|
||||||
|
@ -1465,14 +1465,28 @@ void font_init()
|
|||||||
free(font_path);
|
free(font_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void font_fini()
|
||||||
|
{
|
||||||
|
TTF_CloseFont(menu_font16);
|
||||||
|
TTF_CloseFont(menu_font20);
|
||||||
|
TTF_CloseFont(menu_font8);
|
||||||
|
TTF_CloseFont(menu_font10);
|
||||||
|
|
||||||
|
TTF_Quit();
|
||||||
|
}
|
||||||
|
|
||||||
void menu_init(SDL_Surface *screen)
|
void menu_init(SDL_Surface *screen)
|
||||||
{
|
{
|
||||||
real_screen = screen;
|
real_screen = screen;
|
||||||
|
|
||||||
VirtualKeyboard_init(screen);
|
|
||||||
is_inited = 1;
|
is_inited = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void menu_deinit()
|
||||||
|
{
|
||||||
|
real_screen = 0;
|
||||||
|
is_inited = 0;
|
||||||
|
}
|
||||||
|
|
||||||
int menu_is_inited(void)
|
int menu_is_inited(void)
|
||||||
{
|
{
|
||||||
return is_inited;
|
return is_inited;
|
||||||
|
@ -62,10 +62,14 @@ int msgInfo(char *text, int duration, SDL_Rect *rc);
|
|||||||
|
|
||||||
int msgYesNo(char *text, int def,int x, int y);
|
int msgYesNo(char *text, int def,int x, int y);
|
||||||
|
|
||||||
void font_init();
|
void font_init(void);
|
||||||
|
|
||||||
|
void font_fini(void);
|
||||||
|
|
||||||
void menu_init(SDL_Surface *screen);
|
void menu_init(SDL_Surface *screen);
|
||||||
|
|
||||||
|
void menu_deinit(void);
|
||||||
|
|
||||||
int menu_is_inited(void);
|
int menu_is_inited(void);
|
||||||
|
|
||||||
int ext_matches(const char *name, const char *ext);
|
int ext_matches(const char *name, const char *ext);
|
||||||
|
Loading…
Reference in New Issue
Block a user