Skip to content

Commit 5a2b0f9

Browse files
committed
onscripter-en can build, only support running jp test suite. Running cn test suite will crash
1 parent fffa623 commit 5a2b0f9

File tree

5 files changed

+121
-1
lines changed

5 files changed

+121
-1
lines changed

onscripter-libretro/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
#JH=3:onscripter-en
2+
#JH=2:onscripter-jh_ori, original jh
3+
#JH=1:onscripter-jh, my merged jh
4+
#JH=0:onscripter
5+
16
# xubuntu 20.04 64bit
27
MIYOO:=0
38
JH:=0
@@ -180,6 +185,8 @@ ifeq ($(TINYCO), 1)
180185
endif
181186

182187
ifeq ($(JH),3)
188+
CFLAGS += -DUSE_LABEL=1
189+
CXXFLAGS += -DUSE_LABEL=1
183190
include Makefile-en.common
184191
else ifeq ($(JH),2)
185192
include Makefile-jh_ori.common
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
onscripter-libretro\deps\onscripter-jh\ONScripter_text.cpp
2+
added:if (!info->ttf_font[0]) {
3+
return 0;
4+
}
5+
6+
=====
7+
8+
int ONScripter::drawGlyph( SDL_Surface *dst_surface, FontInfo *info, SDL_Color &color, char* text, int xy[2], AnimationInfo *cache_info, SDL_Rect *clip, SDL_Rect &dst_rect )
9+
{
10+
unsigned short unicode;
11+
if (IS_TWO_BYTE(text[0])){
12+
unsigned index = ((unsigned char*)text)[0];
13+
index = index << 8 | ((unsigned char*)text)[1];
14+
unicode = convSJIS2UTF16( index );
15+
}
16+
else{
17+
if ((text[0] & 0xe0) == 0xa0 || (text[0] & 0xe0) == 0xc0) unicode = ((unsigned char*)text)[0] - 0xa0 + 0xff60;
18+
else unicode = text[0];
19+
}
20+
21+
int minx, maxx, miny, maxy, advanced;
22+
#if 0
23+
if (TTF_GetFontStyle( (TTF_Font*)info->ttf_font[0] ) !=
24+
(info->is_bold?TTF_STYLE_BOLD:TTF_STYLE_NORMAL) )
25+
TTF_SetFontStyle( (TTF_Font*)info->ttf_font[0], (info->is_bold?TTF_STYLE_BOLD:TTF_STYLE_NORMAL));
26+
#endif
27+
if (!info->ttf_font[0]) {
28+
return 0;
29+
}
30+
31+
32+
33+
34+
35+
36+
37+
38+
=================
39+
40+
onscripter-libretro\deps\onscripter-jh\FontInfo.cpp
41+
42+
added 2 places:
43+
if (fc->next->font[1]) { //FIXME:NOeSIS01 crash bug
44+
45+
===
46+
47+
#if defined(PSP)
48+
fc->next->rw_ops = SDL_RWFromFile(font_file, "r");
49+
fc->next->font[0] = TTF_OpenFontRW(fc->next->rw_ops, SDL_TRUE, font_size * ratio1 / ratio2);
50+
#if (SDL_TTF_MAJOR_VERSION >= 2) && (SDL_TTF_MINOR_VERSION >= 0) && (SDL_TTF_PATCHLEVEL >= 10)
51+
fc->next->font[1] = TTF_OpenFontRW(fc->next->rw_ops, SDL_TRUE, font_size * ratio1 / ratio2);
52+
if (fc->next->font[1]) { //FIXME:NOeSIS01 crash bug
53+
TTF_SetFontOutline(fc->next->font[1], 1);
54+
}
55+
#endif
56+
fc->next->power_resume_number = psp_power_resume_number;
57+
strcpy(fc->next->name, font_file);
58+
#else
59+
fp = fopen(font_file, "rb");
60+
fseek(fp, 0, SEEK_END);
61+
long length = ftell(fp);
62+
unsigned char* buf = new unsigned char[length]; // not released
63+
fseek(fp, 0, SEEK_SET);
64+
fread(buf, 1, length, fp);
65+
fclose(fp);
66+
SDL_RWops* src = SDL_RWFromMem(buf, length);
67+
fc->next->font[0] = TTF_OpenFontRW(src, 1, font_size * ratio1 / ratio2);
68+
#if (SDL_TTF_MAJOR_VERSION >= 2) && (SDL_TTF_MINOR_VERSION >= 0) && (SDL_TTF_PATCHLEVEL >= 10)
69+
SDL_RWops* src2 = SDL_RWFromMem(buf, length);
70+
fc->next->font[1] = TTF_OpenFontRW(src2, 1, font_size * ratio1 / ratio2);
71+
if (fc->next->font[1]) { //FIXME:NOeSIS01 crash bug
72+
TTF_SetFontOutline(fc->next->font[1], 1);
73+
}
74+
#endif
75+
#endif
76+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
CFLAGS += -DUSE_LABEL=1
2+
CXXFLAGS += -DUSE_LABEL=1
3+
4+
onscripter-libretro\deps\onscripter-en\ScriptParser.cpp
5+
added: if (!root) { //FIXME:added, why null????
6+
root = "";
7+
}
8+
9+
===
10+
11+
FILE *ScriptParser::fopen( const char *path, const char *mode, const bool save, const bool usesavedir )
12+
{
13+
const char* root;
14+
char *file_name;
15+
FILE *fp = NULL;
16+
17+
if (usesavedir && script_h.savedir) {
18+
root = script_h.savedir;
19+
file_name = new char[strlen(root)+strlen(path)+1];
20+
sprintf( file_name, "%s%s", root, path );
21+
//printf("parser:fopen(\"%s\")\n", file_name);
22+
23+
fp = ::fopen( file_name, mode );
24+
} else if (save) {
25+
root = script_h.save_path;
26+
if (!root) { //FIXME:added, why null????
27+
root = "";
28+
}
29+
file_name = new char[strlen(root)+strlen(path)+1];
30+
sprintf( file_name, "%s%s", root, path );
31+
//printf("parser:fopen(\"%s\")\n", file_name);
32+
33+

onscripter-libretro/deps/onscripter-en/ScriptParser.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,9 @@ FILE *ScriptParser::fopen( const char *path, const char *mode, const bool save,
11131113
fp = ::fopen( file_name, mode );
11141114
} else if (save) {
11151115
root = script_h.save_path;
1116+
if (!root) { //FIXME:added, why null????
1117+
root = "";
1118+
}
11161119
file_name = new char[strlen(root)+strlen(path)+1];
11171120
sprintf( file_name, "%s%s", root, path );
11181121
//printf("parser:fopen(\"%s\")\n", file_name);

onscripter-libretro/libretro.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
#define USE_ONS 1
55
#define USE_NOW 0
66
#define USE_SDLTHREAD 0 //for onscripter-libretro v3
7+
#ifndef USE_LABEL
78
#define USE_LABEL 0//for onscripter-en
8-
9+
#endif
910

1011

1112

0 commit comments

Comments
 (0)