From f79ae799a76beeca85102bcc285c0cf54891d6c0 Mon Sep 17 00:00:00 2001 From: BCC <75528750+bcc2528@users.noreply.github.com> Date: Mon, 2 Dec 2024 02:34:33 +0900 Subject: [PATCH 1/7] Scanline in 15khz screen mode. --- gui/src/main_gui/profiledlg.cpp | 10 ++++++---- gui/src/main_gui/profiledlg.h | 1 + src/towns/render/render.cpp | 11 +++++------ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/gui/src/main_gui/profiledlg.cpp b/gui/src/main_gui/profiledlg.cpp index 07a22fb5..f2ec2c9b 100644 --- a/gui/src/main_gui/profiledlg.cpp +++ b/gui/src/main_gui/profiledlg.cpp @@ -136,15 +136,16 @@ void ProfileDialog::Make(void) CPUFreqTxt=AddTextBox(0,FSKEY_NULL,FsGuiTextBox::HORIZONTAL,"CPU Speed (MHz)",4,YSTRUE); CPUFreqTxt->SetInteger(25); AddStaticText(0,FSKEY_NULL,"(Too-fast frequency rather slows down VM)",YSFALSE); - FPUBtn=AddTextButton(0,FSKEY_NULL,FSGUI_CHECKBOX,"Enable 80387 FPU",YSFALSE); RAMSizeTxt=AddTextBox(0,FSKEY_NULL,FsGuiTextBox::HORIZONTAL,"RAM (MB)",4,YSFALSE); RAMSizeTxt->SetInteger(4); + FPUBtn=AddTextButton(0,FSKEY_NULL,FSGUI_CHECKBOX,"Enable 80387 FPU",YSFALSE); AddStaticText(0,FSKEY_NULL,"CPU Fidelity:",YSTRUE); CPUFidelityDrp=AddEmptyDropList(0,FSKEY_NULL,"",8,20,20,YSFALSE); CPUFidelityDrp->AddString(i486DXCommon::FidelityLevelToStr(i486DXCommon::MID_FIDELITY).c_str(),YSTRUE); CPUFidelityDrp->AddString(i486DXCommon::FidelityLevelToStr(i486DXCommon::HIGH_FIDELITY).c_str(),YSFALSE); CPUFidelityHelpBtn=AddTextButton(0,FSKEY_NULL,FSGUI_PUSHBUTTON,"What's this?",YSFALSE); + pretend386DXBtn=AddTextButton(0,FSKEY_NULL,FSGUI_CHECKBOX,"Pretend 80386DX (Need TownsOS V2.1 L10 etc.)",YSFALSE); CDImgBtn=AddTextButton(0,FSKEY_NULL,FSGUI_PUSHBUTTON,"CD Image:",YSTRUE); CDImgTxt=AddTextBox(0,FSKEY_NULL,FsGuiTextBox::HORIZONTAL,"",nShowPath,YSFALSE); @@ -203,9 +204,7 @@ void ProfileDialog::Make(void) townsTypeDrp->AddString(TownsTypeToStr(TOWNSTYPE_2_HC).c_str(),YSFALSE); townsTypeDrp->AddString(TownsTypeToStr(TOWNSTYPE_MARTY).c_str(),YSFALSE); - - pretend386DXBtn=AddTextButton(0,FSKEY_NULL,FSGUI_CHECKBOX,"Pretend 80386DX",YSFALSE); - + scanLineEffectIn15KHzBtn=AddTextButton(0,FSKEY_NULL,FSGUI_CHECKBOX,"Scanline Effect(Only 15khz Screen)",YSFALSE); damperWireLineBtn=AddTextButton(0,FSKEY_NULL,FSGUI_CHECKBOX,"Render Damper-Wire Line (to make you nostalgic)",YSFALSE); startUpStateFNameBtn=AddTextButton(0,FSKEY_NULL,FSGUI_PUSHBUTTON,"Load VM State",YSTRUE); @@ -1294,6 +1293,7 @@ TownsProfile ProfileDialog::GetProfile(void) const } + profile.scanLineEffectIn15KHz=(YSTRUE==scanLineEffectIn15KHzBtn->GetCheck()); profile.damperWireLine=(YSTRUE==damperWireLineBtn->GetCheck()); profile.separateProcess=(YSTRUE==separateProcBtn->GetCheck()); @@ -1535,6 +1535,8 @@ void ProfileDialog::SetProfile(const TownsProfile &profile) strikeCommanderThrottleAxisDrp->Disable(); } + scanLineEffectIn15KHzBtn->SetCheck(profile.damperWireLine ? YSTRUE : YSFALSE); + damperWireLineBtn->SetCheck(profile.damperWireLine ? YSTRUE : YSFALSE); keyboardModeDrp->SelectByString(TownsKeyboardModeToStr(profile.keyboardMode).c_str()); diff --git a/gui/src/main_gui/profiledlg.h b/gui/src/main_gui/profiledlg.h index 72fab848..032f1804 100644 --- a/gui/src/main_gui/profiledlg.h +++ b/gui/src/main_gui/profiledlg.h @@ -31,6 +31,7 @@ class ProfileDialog : public FsGuiDialog FsGuiButton *ROMDirBtn,*CDImgBtn,*FDImgBtn[TownsProfile::NUM_FDDRIVES],*HDImgBtn[TownsProfile::MAX_NUM_SCSI_DEVICES]; FsGuiButton *FDWriteProtBtn[TownsProfile::NUM_FDDRIVES]; + FsGuiButton *scanLineEffectIn15KHzBtn; FsGuiButton *damperWireLineBtn; FsGuiTextBox *ROMDirTxt,*CDImgTxt,*FDImgTxt[TownsProfile::NUM_FDDRIVES],*HDImgTxt[TownsProfile::MAX_NUM_SCSI_DEVICES]; FsGuiDropList *CDSpeedDrp; diff --git a/src/towns/render/render.cpp b/src/towns/render/render.cpp index 15ad76ca..6ea5d8a4 100644 --- a/src/towns/render/render.cpp +++ b/src/towns/render/render.cpp @@ -182,15 +182,14 @@ void TownsRender::BuildImage(const unsigned char VRAM[],const TownsCRTC::AnalogP if(true==scanLineEffectIn15KHz && 15==frequency) { - auto dy=((scanLineCounter++)&2)>>1; - for(int y=0; y+dy Date: Mon, 2 Dec 2024 19:04:43 +0900 Subject: [PATCH 2/7] fix tips. --- gui/src/main_gui/profiledlg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/src/main_gui/profiledlg.cpp b/gui/src/main_gui/profiledlg.cpp index f2ec2c9b..021a76ab 100644 --- a/gui/src/main_gui/profiledlg.cpp +++ b/gui/src/main_gui/profiledlg.cpp @@ -145,7 +145,7 @@ void ProfileDialog::Make(void) CPUFidelityDrp->AddString(i486DXCommon::FidelityLevelToStr(i486DXCommon::MID_FIDELITY).c_str(),YSTRUE); CPUFidelityDrp->AddString(i486DXCommon::FidelityLevelToStr(i486DXCommon::HIGH_FIDELITY).c_str(),YSFALSE); CPUFidelityHelpBtn=AddTextButton(0,FSKEY_NULL,FSGUI_PUSHBUTTON,"What's this?",YSFALSE); - pretend386DXBtn=AddTextButton(0,FSKEY_NULL,FSGUI_CHECKBOX,"Pretend 80386DX (Need TownsOS V2.1 L10 etc.)",YSFALSE); + pretend386DXBtn=AddTextButton(0,FSKEY_NULL,FSGUI_CHECKBOX,"Pretend 80386DX (for TownsOS V2.1 L10 etc.)",YSFALSE); CDImgBtn=AddTextButton(0,FSKEY_NULL,FSGUI_PUSHBUTTON,"CD Image:",YSTRUE); CDImgTxt=AddTextBox(0,FSKEY_NULL,FsGuiTextBox::HORIZONTAL,"",nShowPath,YSFALSE); @@ -1678,7 +1678,7 @@ void ProfileDialog::ExplainCPUFidelity(void) L"Since High-Fidelity CPU needs to check and handle more exceptions, it is slower than Medium-Fidelity\n" L"CPU core.\n" L"\n" - L"Windows 3.1 requires High-Fidelity CPU core.\n", + L"Windows 3.1, Windows 95, Linux, and OSASK requires High-Fidelity CPU core.\n", L"OK",nullptr); AttachModalDialog(dlg); } From 83fbaa247e8bcf133527762437e9914b45fb52f2 Mon Sep 17 00:00:00 2001 From: BCC <75528750+bcc2528@users.noreply.github.com> Date: Mon, 2 Dec 2024 21:40:20 +0900 Subject: [PATCH 3/7] fix. --- gui/src/main_gui/profiledlg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/main_gui/profiledlg.cpp b/gui/src/main_gui/profiledlg.cpp index 021a76ab..1a3a24e5 100644 --- a/gui/src/main_gui/profiledlg.cpp +++ b/gui/src/main_gui/profiledlg.cpp @@ -1535,7 +1535,7 @@ void ProfileDialog::SetProfile(const TownsProfile &profile) strikeCommanderThrottleAxisDrp->Disable(); } - scanLineEffectIn15KHzBtn->SetCheck(profile.damperWireLine ? YSTRUE : YSFALSE); + scanLineEffectIn15KHzBtn->SetCheck(profile.scanLineEffectIn15KHz ? YSTRUE : YSFALSE); damperWireLineBtn->SetCheck(profile.damperWireLine ? YSTRUE : YSFALSE); From aead2e084eecdec259486d844d17f5f1deaea9b2 Mon Sep 17 00:00:00 2001 From: BCC <75528750+bcc2528@users.noreply.github.com> Date: Mon, 2 Dec 2024 22:02:13 +0900 Subject: [PATCH 4/7] Save scanline 15khz settings. --- gui/src/profile/townsprofile.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gui/src/profile/townsprofile.cpp b/gui/src/profile/townsprofile.cpp index e78a2aff..22bfc538 100644 --- a/gui/src/profile/townsprofile.cpp +++ b/gui/src/profile/townsprofile.cpp @@ -266,6 +266,10 @@ std::vector TownsProfile::Serialize(void) const sstream << "DAMPWIRE " << (damperWireLine ? 1 : 0); text.push_back(sstream.str()); + sstream.str(""); + sstream << "SCANLINE15K " << (scanLineEffectIn15KHz ? 1 : 0); + text.push_back(sstream.str()); + for(auto vk : virtualKeys) { if(""!=vk.townsKey && 0<=vk.physicalId) @@ -706,6 +710,13 @@ bool TownsProfile::Deserialize(const std::vector &text) damperWireLine=(0!=argv[1].Atoi()); } } + else if (0 == argv[0].STRCMP("SCANLINE15K")) + { + if(2<=argv.size()) + { + scanLineEffectIn15KHz=(0!=argv[1].Atoi()); + } + } else if(0==argv[0].STRCMP("FMVOLUME")) { if(2<=argv.size()) @@ -1083,6 +1094,11 @@ std::vector TownsProfile::MakeArgv(void) const argv.push_back("-DAMPERWIRELINE"); } + if(true==scanLineEffectIn15KHz) + { + argv.push_back("-SCANLINE15K"); + } + for(auto vk : virtualKeys) { if(0<=vk.physicalId && ""!=vk.townsKey) From c6b1ed6b88311d62e80309218fafedbd9fc135b8 Mon Sep 17 00:00:00 2001 From: BCC <75528750+bcc2528@users.noreply.github.com> Date: Fri, 27 Dec 2024 18:32:17 +0900 Subject: [PATCH 5/7] Fix scanline brightness. --- src/towns/render/render.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/towns/render/render.cpp b/src/towns/render/render.cpp index 6ea5d8a4..3a713160 100644 --- a/src/towns/render/render.cpp +++ b/src/towns/render/render.cpp @@ -187,9 +187,9 @@ void TownsRender::BuildImage(const unsigned char VRAM[],const TownsCRTC::AnalogP auto linePtr=rgba.data()+y*wid*4; for(int x=0; x>3)*4.7); + linePtr[1]=(unsigned char)((unsigned int)(linePtr[1]>>3)*4.7); + linePtr[2]=(unsigned char)((unsigned int)(linePtr[2]>>3)*4.7); linePtr+=4; } } From 2305c0a2b75606f20a25c99a996c196fa6c08719 Mon Sep 17 00:00:00 2001 From: BCC <75528750+bcc2528@users.noreply.github.com> Date: Sun, 29 Dec 2024 19:35:59 +0900 Subject: [PATCH 6/7] Fix frame drop. --- src/towns/townsthread.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/towns/townsthread.cpp b/src/towns/townsthread.cpp index 4c81d2bc..78355198 100644 --- a/src/towns/townsthread.cpp +++ b/src/towns/townsthread.cpp @@ -192,13 +192,13 @@ void TownsThread::VMMainLoopTemplate( } break; } + + CheckRenderingTimer(*townsPtr,*window,outside_world->ImageNeedsFlip()); } } townsPtr->ProcessSound(outside_world); townsPtr->cdrom.UpdateCDDAState(townsPtr->state.townsTime); - CheckRenderingTimer(*townsPtr,*window,outside_world->ImageNeedsFlip()); - outside_world->ProcessAppSpecific(*townsPtr); if(townsPtr->state.nextDevicePollingTimestate.townsTime) { From cebeba8af60bb0bb477747d8996770c9f04cf742 Mon Sep 17 00:00:00 2001 From: BCC <75528750+bcc2528@users.noreply.github.com> Date: Wed, 1 Jan 2025 01:19:00 +0900 Subject: [PATCH 7/7] Fix command bar flicker in Lemmings 2. --- src/towns/crtc/crtc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/towns/crtc/crtc.cpp b/src/towns/crtc/crtc.cpp index d77cde07..81856bef 100644 --- a/src/towns/crtc/crtc.cpp +++ b/src/towns/crtc/crtc.cpp @@ -334,7 +334,7 @@ bool TownsCRTC::InHSYNC(const unsigned long long int townsTime) const bool TownsCRTC::First1msOfVerticalPeriod(const unsigned long long int townsTime) const { unsigned int intoFrame=((unsigned long long)townsTime)%VSYNC_CYCLE; - return intoFrame<1000000; + return 1000000