Fix the build after archiving rpg/ui/scene: drop their last live dependents

rpg/ui/scene moved to archive/ earlier left a handful of otherwise-generic
systems with dead references into them:
- asset/loader/chunk existed solely to load rpg overworld map chunks
  (tile_t, worldpos_t) - deleted outright, along with its
  ASSET_LOADER_TYPE_CHUNK entry in assetloader.c/h.
- save/slot wrapped party_t/storyflagval_t/map-name/cutscene-path, which is
  100% rpg save data - deleted outright (save.c/h, savedevice.c/h and the
  Linux save backend keep their generic settings/device-discovery logic,
  just lose the slot read/write pieces that only existed for it).
- locale/localemanager.c and test/CMakeLists.txt/test/save/* had a few
  stray includes and test cases that only existed for the now-gone code.

Also restores assets/locale/en_US.po (copied back from archive/assets/) -
locale init still needs a real locale file to boot into, even with the
asset-moving/archiving done separately.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
YourWishesandClaude Sonnet 5 committed 2026-10-15 09:08:02 -05:00
1 parent f6b884bf7f
commit fdfdfa3a66
31 files changed
+292 -1994

No files matched your search

-149
View File
@@ -9,9 +9,7 @@
#include "savetestfixture.h"
#include "save/savedevice.h"
#include "save/savedevicelinux.h"
#include "save/slot/saveslot.h"
#include "save/settings/savesettings.h"
#include "save/save.h"
#include "util/memory.h"
#include "util/string.h"
#include <stdio.h>
@@ -86,27 +84,6 @@ static void test_getSettingsPath_homeUnset_errors(void **state) {
errorCatch(ret);
}
static void test_getSlotPath_success(void **state) {
char_t path[512];
errorret_t ret = saveDeviceLinuxGetSlotPath(path, sizeof(path), 2);
assert_true(errorIsOk(ret));
char_t expected[512];
stringFormat(
expected, sizeof(expected), "%s/.dusk/saves/slot2.json", getenv("HOME")
);
assert_true(stringEquals(path, expected));
}
static void test_getSlotPath_homeUnset_errors(void **state) {
unsetenv("HOME");
char_t path[512];
errorret_t ret = saveDeviceLinuxGetSlotPath(path, sizeof(path), 0);
assert_true(errorIsNotOk(ret));
errorCatch(ret);
}
// ============================================================
// saveDeviceLinuxCheckAvailability
// ============================================================
@@ -175,105 +152,6 @@ static void test_checkAvailability_mkdirpFails(void **state) {
assert_true(g_callbackFired);
}
// ============================================================
// saveDeviceLinuxSlotWrite / saveDeviceLinuxSlotRead
// ============================================================
static void test_slotWrite_nullAsserts(void **state) {
savedevice_t device;
// Content is never touched - both calls assert on a NULL argument
// before either device or slot would actually be read.
saveslot_t slot;
expect_assert_failure(saveDeviceLinuxSlotWrite(NULL, &slot, 0));
expect_assert_failure(saveDeviceLinuxSlotWrite(&device, NULL, 0));
}
static void test_slotRead_nullAsserts(void **state) {
savedevice_t device;
saveslot_t slot;
expect_assert_failure(saveDeviceLinuxSlotRead(NULL, &slot, 0));
expect_assert_failure(saveDeviceLinuxSlotRead(&device, NULL, 0));
}
static void test_slotWriteRead_roundTrip(void **state) {
savedevice_t device;
memoryZero(&device, sizeof(device));
// The save directory must exist before a write can succeed - normally
// saveDeviceLinuxCheckAvailability does this via mkdirp.
checkAvailabilityAndDrain(&device);
// saveSlotInit() only ever operates on SAVE.slot now, so that's the
// write source here.
saveSlotInit(&SAVE.slot);
stringCopy(
SAVE.slot.cachedData.name, "Hero", sizeof(SAVE.slot.cachedData.name)
);
SAVE.slot.cachedData.playerLevel = 9;
errorret_t writeRet = saveDeviceLinuxSlotWrite(&device, &SAVE.slot, 1);
assert_true(errorIsOk(writeRet));
// No pre-init needed - saveSlotReadJSON() (via saveDeviceLinuxSlotRead)
// fully resets/overwrites its destination struct regardless of prior
// content.
saveslot_t read;
errorret_t readRet = saveDeviceLinuxSlotRead(&device, &read, 1);
assert_true(errorIsOk(readRet));
assert_true(stringEquals(read.cachedData.name, "Hero"));
assert_int_equal(read.cachedData.playerLevel, 9);
}
static void test_slotRead_noFileYet_leavesSlotUntouched(void **state) {
savedevice_t device;
memoryZero(&device, sizeof(device));
// Deliberately not saveSlotInit()'d - a missing slot file means
// saveDeviceLinuxSlotRead never even calls saveSlotReadJSON, so slot
// must come in exactly as the caller left it and go out unchanged.
saveslot_t slot;
memoryZero(&slot, sizeof(slot));
stringCopy(slot.cachedData.name, "sentinel", sizeof(slot.cachedData.name));
slot.cachedData.playerLevel = 555;
errorret_t ret = saveDeviceLinuxSlotRead(&device, &slot, 2);
assert_true(errorIsOk(ret));
assert_true(stringEquals(slot.cachedData.name, "sentinel"));
assert_int_equal(slot.cachedData.playerLevel, 555);
}
static void test_slotRead_corruptFile_errors(void **state) {
savedevice_t device;
memoryZero(&device, sizeof(device));
// The directory must exist before we can drop a file into it - normally
// saveDeviceLinuxCheckAvailability does this via mkdirp.
savedevice_t tmpDevice;
memoryZero(&tmpDevice, sizeof(tmpDevice));
tmpDevice.state = SAVE_DEVICE_STATE_CHECKING_AVAILABILITY;
saveDeviceLinuxCheckAvailability(&tmpDevice);
assert_int_equal(tmpDevice.state, SAVE_DEVICE_STATE_AVAILABLE);
char_t slotPath[512];
errorret_t pathRet =
saveDeviceLinuxGetSlotPath(slotPath, sizeof(slotPath), 0);
assert_true(errorIsOk(pathRet));
FILE *file = fopen(slotPath, "w");
assert_non_null(file);
fprintf(file, "not valid json {{{");
fclose(file);
saveslot_t slot;
errorret_t ret = saveDeviceLinuxSlotRead(&device, &slot, 0);
assert_true(errorIsNotOk(ret));
errorCatch(ret);
}
// ============================================================
// saveDeviceLinuxSettingsWrite / saveDeviceLinuxSettingsRead
// ============================================================
@@ -381,14 +259,6 @@ int main(void) {
test_getSettingsPath_homeUnset_errors,
saveTestFixtureSetup, saveTestFixtureTeardown
),
cmocka_unit_test_setup_teardown(
test_getSlotPath_success, saveTestFixtureSetup, saveTestFixtureTeardown
),
cmocka_unit_test_setup_teardown(
test_getSlotPath_homeUnset_errors,
saveTestFixtureSetup, saveTestFixtureTeardown
),
cmocka_unit_test_setup_teardown(
test_checkAvailability_wrongStateAsserts,
saveTestFixtureSetup, saveTestFixtureTeardown
@@ -410,25 +280,6 @@ int main(void) {
saveTestFixtureSetup, saveTestFixtureTeardown
),
cmocka_unit_test_setup_teardown(
test_slotWrite_nullAsserts, saveTestFixtureSetup, saveTestFixtureTeardown
),
cmocka_unit_test_setup_teardown(
test_slotRead_nullAsserts, saveTestFixtureSetup, saveTestFixtureTeardown
),
cmocka_unit_test_setup_teardown(
test_slotWriteRead_roundTrip,
saveTestFixtureSetup, saveTestFixtureTeardown
),
cmocka_unit_test_setup_teardown(
test_slotRead_noFileYet_leavesSlotUntouched,
saveTestFixtureSetup, saveTestFixtureTeardown
),
cmocka_unit_test_setup_teardown(
test_slotRead_corruptFile_errors,
saveTestFixtureSetup, saveTestFixtureTeardown
),
cmocka_unit_test_setup_teardown(
test_settingsWrite_nullAsserts,
saveTestFixtureSetup, saveTestFixtureTeardown