Skip to content

Commit

Permalink
Workaround for TTF output freezes PC-98 mode
Browse files Browse the repository at this point in the history
  • Loading branch information
maron2000 committed Feb 9, 2025
1 parent 5d509c8 commit 5acf6ac
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/ints/bios.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ extern bool en_bios_ps2mouse;
extern bool rom_bios_8x8_cga_font;
extern bool pcibus_enable;
extern bool enable_fpu;
extern bool finish_prepare;
extern bool is_ttfswitched_on;

bool pc98_timestamp5c = true; // port 5ch and 5eh "time stamp/hardware wait"

Expand All @@ -152,9 +154,11 @@ void SetIMPosition(void);
bool isDBCSCP();
Bitu INT60_Handler(void);
Bitu INT6F_Handler(void);
bool toOutput(const char* what);
#if defined(USE_TTF)
void ttf_switch_on(bool ss), ttf_switch_off(bool ss), ttf_setlines(int cols, int lins);
#endif
std::string conf_output;

/* Rate limit log entries regarding APM AH=05h CPU IDLE because Windows 98's APM driver likes to call it way too much per second */
pic_tickindex_t APM_log_cpu_idle_next_report = 0;
Expand Down Expand Up @@ -3814,7 +3818,19 @@ static Bitu INT18_PC98_Handler(void) {
SegValue(es));
}
#endif

#if defined(USE_TTF)
if(ttf.inUse)
ttf_reset();
else {
conf_output= static_cast<Section_prop*>(control->GetSection("sdl"))->Get_string("output");
if(!finish_prepare && conf_output == "ttf") { // Workaround for blank BIOS screen in TTF mode
toOutput("surface");
toOutput("ttf");
ttf_switch_off(true);
is_ttfswitched_on = true;
}
}
#endif
/* NTS: Based on information gleaned from Neko Project II source code including comments which
* I've run through GNU iconv to convert from SHIFT-JIS to UTF-8 here in case Google Translate
* got anything wrong. */
Expand Down
5 changes: 5 additions & 0 deletions src/output/output_ttf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ static alt_rgb *rgbColors = (alt_rgb*)render.pal.rgb;
static bool blinkstate = false;
bool colorChanged = false, justChanged = false, staycolors = false, firstsize = true, ttfswitch = false, switch_output_from_ttf = false;
bool init_once = false, init_twice = false;
extern bool finish_prepare;
bool is_ttfswitched_on=false;

int menuwidth_atleast(int width), FileDirExistCP(const char *name), FileDirExistUTF8(std::string &localname, const char *name);
void AdjustIMEFontSize(void),refreshExtChar(void), initcodepagefont(void), change_output(int output), drawmenu(Bitu val), KEYBOARD_Clear(void), RENDER_Reset(void), DOSBox_SetSysMenu(void), GetMaxWidthHeight(unsigned int *pmaxWidth, unsigned int *pmaxHeight), SetWindowTransparency(int trans), resetFontSize(void), RENDER_CallBack( GFX_CallBackFunctions_t function );
Expand Down Expand Up @@ -1410,6 +1412,7 @@ void ttf_setlines(int cols, int lins) {
}

void ttf_switch_on(bool ss=true) {
if(!finish_prepare) return;
if ((ss&&ttfswitch)||(!ss&&switch_output_from_ttf)) {
checkcol = 0;
if (strcmp(RunningProgram, "LOADLIN")) {
Expand Down Expand Up @@ -1459,6 +1462,7 @@ void ttf_switch_on(bool ss=true) {
#endif
if (!IS_PC98_ARCH && vga.draw.address_add != ttf.cols * 2) checkcol = ss?2:1;
}
is_ttfswitched_on = true;
}

void ttf_switch_off(bool ss=true) {
Expand Down Expand Up @@ -1511,5 +1515,6 @@ void ttf_switch_off(bool ss=true) {
#endif
if (Mouse_IsLocked()) GFX_CaptureMouse(true);
}
is_ttfswitched_on = false;
}
#endif

0 comments on commit 5acf6ac

Please sign in to comment.