mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-25 12:06:53 +01:00
add ability to externally load fonts and activate japanese/korean
translations.
This commit is contained in:
parent
23ae2a2349
commit
e0b0f005b2
BIN
fonts/jp.ttf
Normal file
BIN
fonts/jp.ttf
Normal file
Binary file not shown.
BIN
fonts/ko.ttf
Normal file
BIN
fonts/ko.ttf
Normal file
Binary file not shown.
@ -38,6 +38,12 @@ https://github.com/dborth/vbagx/releases
|
|||||||
|0O×øo· UPDATE HISTORY ·oø×O0|
|
|0O×øo· UPDATE HISTORY ·oø×O0|
|
||||||
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
|
||||||
|
|
||||||
|
[2.3.9]
|
||||||
|
|
||||||
|
* Added ability to load external fonts and activated Japanese/Korean
|
||||||
|
translations. Simply put the ko.ttf or jp.ttf in the app directory
|
||||||
|
* Added ability to change preview image source with + button (thanks Zalo!)
|
||||||
|
|
||||||
[2.3.8 - January 4, 2019]
|
[2.3.8 - January 4, 2019]
|
||||||
|
|
||||||
* Restored changes lost from 2.3.0 core upgrade (GameCube virtual memory,
|
* Restored changes lost from 2.3.0 core upgrade (GameCube virtual memory,
|
||||||
|
@ -34,9 +34,14 @@
|
|||||||
#include "filebrowser.h"
|
#include "filebrowser.h"
|
||||||
#include "gui/gui.h"
|
#include "gui/gui.h"
|
||||||
|
|
||||||
|
#ifdef HW_RVL
|
||||||
|
#include "mem2.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define THREAD_SLEEP 100
|
#define THREAD_SLEEP 100
|
||||||
|
|
||||||
unsigned char *savebuffer = NULL;
|
unsigned char *savebuffer = NULL;
|
||||||
|
u8 *ext_font_ttf = NULL;
|
||||||
static mutex_t bufferLock = LWP_MUTEX_NULL;
|
static mutex_t bufferLock = LWP_MUTEX_NULL;
|
||||||
FILE * file; // file pointer - the only one we should ever use!
|
FILE * file; // file pointer - the only one we should ever use!
|
||||||
bool unmountRequired[7] = { false, false, false, false, false, false, false };
|
bool unmountRequired[7] = { false, false, false, false, false, false, false };
|
||||||
@ -854,6 +859,43 @@ size_t LoadFile(char * filepath, bool silent)
|
|||||||
return LoadFile((char *)savebuffer, filepath, 0, SAVEBUFFERSIZE, silent);
|
return LoadFile((char *)savebuffer, filepath, 0, SAVEBUFFERSIZE, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HW_RVL
|
||||||
|
size_t LoadFont(char * filepath)
|
||||||
|
{
|
||||||
|
FILE *file = fopen (filepath, "rb");
|
||||||
|
|
||||||
|
if(!file) {
|
||||||
|
ErrorPrompt("Font file not found!");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fseeko(file,0,SEEK_END);
|
||||||
|
size_t loadSize = ftello(file);
|
||||||
|
|
||||||
|
if(loadSize == 0) {
|
||||||
|
ErrorPrompt("Error loading font!");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ext_font_ttf) {
|
||||||
|
mem2_free(ext_font_ttf);
|
||||||
|
}
|
||||||
|
|
||||||
|
ext_font_ttf = (u8 *)mem2_malloc(loadSize);
|
||||||
|
|
||||||
|
if(!ext_font_ttf) {
|
||||||
|
ErrorPrompt("Font file is too large!");
|
||||||
|
fclose(file);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fseeko(file,0,SEEK_SET);
|
||||||
|
fread (ext_font_ttf, 1, loadSize, file);
|
||||||
|
fclose(file);
|
||||||
|
return loadSize;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* SaveFile
|
* SaveFile
|
||||||
* Write buffer to file
|
* Write buffer to file
|
||||||
|
@ -36,10 +36,12 @@ void FreeSaveBuffer();
|
|||||||
size_t LoadFile(char * rbuffer, char *filepath, size_t length, size_t buffersize, bool silent);
|
size_t LoadFile(char * rbuffer, char *filepath, size_t length, size_t buffersize, bool silent);
|
||||||
size_t LoadFile(char * filepath, bool silent);
|
size_t LoadFile(char * filepath, bool silent);
|
||||||
size_t LoadSzFile(char * filepath, unsigned char * rbuffer);
|
size_t LoadSzFile(char * filepath, unsigned char * rbuffer);
|
||||||
|
size_t LoadFont(char *filepath);
|
||||||
size_t SaveFile(char * buffer, char *filepath, size_t datasize, bool silent);
|
size_t SaveFile(char * buffer, char *filepath, size_t datasize, bool silent);
|
||||||
size_t SaveFile(char * filepath, size_t datasize, bool silent);
|
size_t SaveFile(char * filepath, size_t datasize, bool silent);
|
||||||
|
|
||||||
extern unsigned char *savebuffer;
|
extern unsigned char *savebuffer;
|
||||||
|
extern u8 *ext_font_ttf;
|
||||||
extern FILE * file;
|
extern FILE * file;
|
||||||
extern bool unmountRequired[];
|
extern bool unmountRequired[];
|
||||||
extern bool isMounted[];
|
extern bool isMounted[];
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "gamesettings.h"
|
#include "gamesettings.h"
|
||||||
#include "gui/gui.h"
|
#include "gui/gui.h"
|
||||||
#include "utils/gettext.h"
|
#include "utils/gettext.h"
|
||||||
|
#include "utils/FreeTypeGX.h"
|
||||||
|
|
||||||
#define THREAD_SLEEP 100
|
#define THREAD_SLEEP 100
|
||||||
|
|
||||||
@ -111,7 +112,7 @@ HaltGui()
|
|||||||
usleep(THREAD_SLEEP);
|
usleep(THREAD_SLEEP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetText()
|
static void ResetText()
|
||||||
{
|
{
|
||||||
LoadLanguage();
|
LoadLanguage();
|
||||||
|
|
||||||
@ -119,6 +120,58 @@ void ResetText()
|
|||||||
mainWindow->ResetText();
|
mainWindow->ResetText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int currentLanguage = -1;
|
||||||
|
|
||||||
|
void ChangeLanguage() {
|
||||||
|
if(currentLanguage == GCSettings.language) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(GCSettings.language == LANG_JAPANESE || GCSettings.language == LANG_KOREAN) {
|
||||||
|
#ifdef HW_RVL
|
||||||
|
char filepath[MAXPATHLEN];
|
||||||
|
|
||||||
|
switch(GCSettings.language) {
|
||||||
|
case LANG_KOREAN:
|
||||||
|
sprintf(filepath, "%s/ko.ttf", appPath);
|
||||||
|
break;
|
||||||
|
case LANG_JAPANESE:
|
||||||
|
sprintf(filepath, "%s/jp.ttf", appPath);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t fontSize = LoadFont(filepath);
|
||||||
|
|
||||||
|
if(fontSize > 0) {
|
||||||
|
HaltGui();
|
||||||
|
DeinitFreeType();
|
||||||
|
InitFreeType((u8*)ext_font_ttf, fontSize);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
GCSettings.language = currentLanguage;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
GCSettings.language = currentLanguage;
|
||||||
|
ErrorPrompt("Unsupported language!");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#ifdef HW_RVL
|
||||||
|
else {
|
||||||
|
if(ext_font_ttf != NULL) {
|
||||||
|
HaltGui();
|
||||||
|
DeinitFreeType();
|
||||||
|
mem2_free(ext_font_ttf);
|
||||||
|
ext_font_ttf = NULL;
|
||||||
|
InitFreeType((u8*)font_ttf, font_ttf_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
HaltGui();
|
||||||
|
ResetText();
|
||||||
|
currentLanguage = GCSettings.language;
|
||||||
|
ResumeGui();
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* WindowPrompt
|
* WindowPrompt
|
||||||
*
|
*
|
||||||
@ -3649,6 +3702,7 @@ static int MenuSettingsMenu()
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
bool firstRun = true;
|
bool firstRun = true;
|
||||||
OptionList options;
|
OptionList options;
|
||||||
|
currentLanguage = GCSettings.language;
|
||||||
|
|
||||||
sprintf(options.name[i++], "Exit Action");
|
sprintf(options.name[i++], "Exit Action");
|
||||||
sprintf(options.name[i++], "Wiimote Orientation");
|
sprintf(options.name[i++], "Wiimote Orientation");
|
||||||
@ -3736,9 +3790,7 @@ static int MenuSettingsMenu()
|
|||||||
GCSettings.language = LANG_JAPANESE;
|
GCSettings.language = LANG_JAPANESE;
|
||||||
|
|
||||||
if(GCSettings.language == LANG_SIMP_CHINESE)
|
if(GCSettings.language == LANG_SIMP_CHINESE)
|
||||||
GCSettings.language = LANG_PORTUGUESE;
|
GCSettings.language = LANG_KOREAN;
|
||||||
else if(GCSettings.language == LANG_JAPANESE)
|
|
||||||
GCSettings.language = LANG_ENGLISH;
|
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
GCSettings.PreviewImage++;
|
GCSettings.PreviewImage++;
|
||||||
@ -3832,11 +3884,11 @@ static int MenuSettingsMenu()
|
|||||||
menu = MENU_SETTINGS;
|
menu = MENU_SETTINGS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ChangeLanguage();
|
||||||
HaltGui();
|
HaltGui();
|
||||||
mainWindow->Remove(&optionBrowser);
|
mainWindow->Remove(&optionBrowser);
|
||||||
mainWindow->Remove(&w);
|
mainWindow->Remove(&w);
|
||||||
mainWindow->Remove(&titleTxt);
|
mainWindow->Remove(&titleTxt);
|
||||||
ResetText();
|
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ int YesNoPrompt(const char *msg, bool yesDefault);
|
|||||||
void ShowAction (const char *msg);
|
void ShowAction (const char *msg);
|
||||||
void CancelAction();
|
void CancelAction();
|
||||||
void ShowProgress (const char *msg, int done, int total);
|
void ShowProgress (const char *msg, int done, int total);
|
||||||
void ResetText();
|
void ChangeLanguage();
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -848,7 +848,7 @@ bool LoadPrefs()
|
|||||||
CreateDirectory(dirPath);
|
CreateDirectory(dirPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResetText();
|
ChangeLanguage();
|
||||||
return prefFound;
|
return prefFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user