(by Codex) Restore original startup screens and edition runtime defaults

This commit is contained in:
Codex committed 2026-11-01 17:37:48 +01:00
1 parent db56c323aa
commit c8ae7a31d2
11 files changed
+136 -7

No files matched your search

+9
View File
@@ -41,5 +41,14 @@ int main()try {
auto different=image(1995,5);const uint8_t unknown=0;different.patch(bmh::layout::CalendarDateSetup,&unknown,1);
rejected=false;try{bmh::calendar_epoch_from_executable(different);}catch(const bmh::FormatError&){rejected=true;}
check(rejected,"unknown date routine was guessed");
auto english=image(1995,5);
const uint8_t english_setup[]={0xc6,0x45,0xf6,5,0xc6,0x45,0xf7,7,0x66,0xc7,0x45,0xf8,0xcb,7};
english.patch(bmh::layout::CalendarDateSetup,english_setup,sizeof english_setup);
const auto english_epoch=bmh::calendar_epoch_from_executable(english);
check(english_epoch.year==1995&&english_epoch.weekday==5,"translated English date operands rejected");
const uint8_t invalid_weekday=7;
english.patch(bmh::layout::CalendarDateSetup+3,&invalid_weekday,1);
rejected=false;try{bmh::calendar_epoch_from_executable(english);}catch(const bmh::FormatError&){rejected=true;}
check(rejected,"invalid translated English weekday accepted");
std::cout<<"Edition calendar epoch, save header and year rollover passed\n";return 0;
}catch(const std::exception&e){std::cerr<<e.what()<<'\n';return 1;}
+2
View File
@@ -15,6 +15,8 @@ int main(int argc,char**argv){try{
auto db=load_database(data/"M3D.MAN");auto texts=load_textd(data/"TEXTD.BLK");
auto before=startup_state(exe,db,read_file(data/"M3.MEN"),read_file(data/"M3.DAT"));
before.texts=&texts;
check(before.memory.has(layout::CompactDialogFrame)&&before.memory.u8(layout::CompactDialogFrame)==0,
"options entry disables the boot-only black dialog frame");
for(unsigned i=0;i<4;++i)check(exe.u32(::bmh::layout::OfferSlots+i*4)==0&&before.memory.u32(::bmh::layout::OfferSlots+i*4)==0,
"raw EXE BSS and startup_state carry zero, not empty pending offer sentinel");
// Use the existing exact6ba3e split helpers as unchanged baseline, with
+50
View File
@@ -0,0 +1,50 @@
// SPDX-License-Identifier: GPL-3.0-only
#include "app/controller.hpp"
#include "formats/executable_layout.hpp"
#include "game/save.hpp"
#include <algorithm>
#include <iostream>
#include <stdexcept>
using namespace bmh;
using namespace bmh::ui;
namespace { void check(bool ok,const char* message){if(!ok)throw std::runtime_error(message);} }
int main(int argc,char** argv)try {
if(argc<2||!*argv[1])return 77;
const std::filesystem::path data=argv[1];
StartupFlow flow(data);
std::unique_ptr<app::CareerSession> session;
uint64_t revision=0;
openbmh::audio::Playback playback;
std::optional<uint64_t> audio;
const auto serve=[&](const FlowResult& result) {
check(app::serve_flow_request(flow,result,session,data,data,0x12345678,
revision,playback,audio,false).empty(),"production startup/navigation failed");
};
flow.click(150,215);flow.click(5,225,true);flow.click(5,225,true);
serve(flow.click(90,169));
check(session&&flow.screen_name()=="desktop","edition did not reach an actual career desk");
check(session->state().memory.has(layout::CompactDialogFrame)&&
session->state().memory.u8(layout::CompactDialogFrame)==0,
"setup retained the boot-only black dialog mode");
const auto native=save_stream(session->state());
const auto game=session->game();const auto random=session->rand();
const auto before_revision=revision;
for(int kind:{8,7}) {
const auto& items=flow.desktop()->state().items;
const auto it=std::find_if(items.begin(),items.end(),[&](const auto& item){return item.kind==kind&&!item.disabled;});
check(it!=items.end(),"edition lacks the enabled original calendar menu");
serve(flow.click(it->x+it->width/2,it->y+it->height/2));
check(flow.calendar()&&flow.screen_name()==(kind==8?"calendar":"reschedule_calendar"),
"original calendar menu did not open");
check(flow.render().pixels.size()==320*240,"calendar did not render a complete original frame");
serve(flow.send_key("ESC"));
check(flow.screen_name()=="desktop"&&!flow.desktop()->pending(),"calendar did not return its desk owner");
}
check(save_stream(session->state())==native&&revision==before_revision&&
session->game().seed()==game.seed()&&session->game().calls()==game.calls()&&
session->rand().seed()==random.seed()&&session->rand().calls()==random.calls(),
"opening calendars changed the career or random streams");
std::cout<<"Edition career startup, original calendar/rescheduling navigation and dialog mode passed\n";
return 0;
}catch(const std::exception& e){std::cerr<<e.what()<<'\n';return 1;}