mirror of
https://github.com/rommapp/romm.git
synced 2026-10-12 02:21:58 +00:00
Merge pull request #2793 from rommapp/ejs-disable-batch-bootup
Add config options to disable batch bootup and auto unload in emujs
This commit is contained in:
@@ -84,6 +84,8 @@ class Config:
|
||||
HIGH_PRIO_STRUCTURE_PATH: str
|
||||
EJS_DEBUG: bool
|
||||
EJS_CACHE_LIMIT: int | None
|
||||
EJS_DISABLE_AUTO_UNLOAD: bool
|
||||
EJS_DISABLE_BATCH_BOOTUP: bool
|
||||
EJS_NETPLAY_ENABLED: bool
|
||||
EJS_NETPLAY_ICE_SERVERS: list[NetplayICEServer]
|
||||
EJS_SETTINGS: dict[str, EjsOption] # core_name -> EjsOption
|
||||
@@ -228,6 +230,12 @@ class ConfigManager:
|
||||
EJS_CACHE_LIMIT=pydash.get(
|
||||
self._raw_config, "emulatorjs.cache_limit", None
|
||||
),
|
||||
EJS_DISABLE_AUTO_UNLOAD=pydash.get(
|
||||
self._raw_config, "emulatorjs.disable_auto_unload", False
|
||||
),
|
||||
EJS_DISABLE_BATCH_BOOTUP=pydash.get(
|
||||
self._raw_config, "emulatorjs.disable_batch_bootup", False
|
||||
),
|
||||
EJS_NETPLAY_ENABLED=pydash.get(
|
||||
self._raw_config, "emulatorjs.netplay.enabled", False
|
||||
),
|
||||
@@ -419,6 +427,18 @@ class ConfigManager:
|
||||
)
|
||||
sys.exit(3)
|
||||
|
||||
if not isinstance(self.config.EJS_DISABLE_AUTO_UNLOAD, bool):
|
||||
log.critical(
|
||||
"Invalid config.yml: emulatorjs.disable_auto_unload must be a boolean"
|
||||
)
|
||||
sys.exit(3)
|
||||
|
||||
if not isinstance(self.config.EJS_DISABLE_BATCH_BOOTUP, bool):
|
||||
log.critical(
|
||||
"Invalid config.yml: emulatorjs.disable_batch_bootup must be a boolean"
|
||||
)
|
||||
sys.exit(3)
|
||||
|
||||
if not isinstance(self.config.EJS_NETPLAY_ICE_SERVERS, list):
|
||||
log.critical(
|
||||
"Invalid config.yml: emulatorjs.netplay.ice_servers must be a list"
|
||||
@@ -533,6 +553,8 @@ class ConfigManager:
|
||||
"emulatorjs": {
|
||||
"debug": self.config.EJS_DEBUG,
|
||||
"cache_limit": self.config.EJS_CACHE_LIMIT,
|
||||
"disable_auto_unload": self.config.EJS_DISABLE_AUTO_UNLOAD,
|
||||
"disable_batch_bootup": self.config.EJS_DISABLE_BATCH_BOOTUP,
|
||||
"netplay": {
|
||||
"enabled": self.config.EJS_NETPLAY_ENABLED,
|
||||
"ice_servers": self.config.EJS_NETPLAY_ICE_SERVERS,
|
||||
|
||||
@@ -37,6 +37,8 @@ def get_config() -> ConfigResponse:
|
||||
SKIP_HASH_CALCULATION=cfg.SKIP_HASH_CALCULATION,
|
||||
EJS_DEBUG=cfg.EJS_DEBUG,
|
||||
EJS_CACHE_LIMIT=cfg.EJS_CACHE_LIMIT,
|
||||
EJS_DISABLE_AUTO_UNLOAD=cfg.EJS_DISABLE_AUTO_UNLOAD,
|
||||
EJS_DISABLE_BATCH_BOOTUP=cfg.EJS_DISABLE_BATCH_BOOTUP,
|
||||
EJS_NETPLAY_ENABLED=cfg.EJS_NETPLAY_ENABLED,
|
||||
EJS_NETPLAY_ICE_SERVERS=cfg.EJS_NETPLAY_ICE_SERVERS,
|
||||
EJS_CONTROLS=cfg.EJS_CONTROLS,
|
||||
|
||||
@@ -17,6 +17,8 @@ class ConfigResponse(TypedDict):
|
||||
SKIP_HASH_CALCULATION: bool
|
||||
EJS_DEBUG: bool
|
||||
EJS_CACHE_LIMIT: int | None
|
||||
EJS_DISABLE_AUTO_UNLOAD: bool
|
||||
EJS_DISABLE_BATCH_BOOTUP: bool
|
||||
EJS_NETPLAY_ENABLED: bool
|
||||
EJS_NETPLAY_ICE_SERVERS: list[NetplayICEServer]
|
||||
EJS_SETTINGS: dict[str, dict[str, str]]
|
||||
|
||||
@@ -55,6 +55,8 @@ scan:
|
||||
emulatorjs:
|
||||
debug: true
|
||||
cache_limit: 1000
|
||||
disable_auto_unload: true
|
||||
disable_batch_bootup: true
|
||||
netplay:
|
||||
enabled: true
|
||||
ice_servers:
|
||||
|
||||
@@ -21,6 +21,8 @@ def test_config_loader():
|
||||
assert loader.config.FIRMWARE_FOLDER_NAME == "BIOS"
|
||||
assert loader.config.SKIP_HASH_CALCULATION
|
||||
assert loader.config.EJS_DEBUG
|
||||
assert loader.config.EJS_DISABLE_AUTO_UNLOAD
|
||||
assert loader.config.EJS_DISABLE_BATCH_BOOTUP
|
||||
assert loader.config.EJS_CACHE_LIMIT == 1000
|
||||
assert loader.config.EJS_NETPLAY_ENABLED
|
||||
assert loader.config.EJS_NETPLAY_ICE_SERVERS == [
|
||||
@@ -69,6 +71,8 @@ def test_empty_config_loader():
|
||||
assert not loader.config.SKIP_HASH_CALCULATION
|
||||
assert not loader.config.EJS_DEBUG
|
||||
assert loader.config.EJS_CACHE_LIMIT is None
|
||||
assert not loader.config.EJS_DISABLE_AUTO_UNLOAD
|
||||
assert not loader.config.EJS_DISABLE_BATCH_BOOTUP
|
||||
assert not loader.config.EJS_NETPLAY_ENABLED
|
||||
assert loader.config.EJS_NETPLAY_ICE_SERVERS == []
|
||||
assert loader.config.EJS_SETTINGS == {}
|
||||
|
||||
@@ -137,6 +137,8 @@
|
||||
# emulatorjs:
|
||||
# debug: true # Available options will be logged to the browser console
|
||||
# cache_limit: null # Cache limit per ROM (in bytes)
|
||||
# disable_batch_bootup: false
|
||||
# disable_auto_unload: false
|
||||
# settings:
|
||||
# parallel_n64: # Use the exact core name
|
||||
# vsync: disabled
|
||||
|
||||
@@ -18,6 +18,8 @@ export type ConfigResponse = {
|
||||
SKIP_HASH_CALCULATION: boolean;
|
||||
EJS_DEBUG: boolean;
|
||||
EJS_CACHE_LIMIT: (number | null);
|
||||
EJS_DISABLE_AUTO_UNLOAD: boolean;
|
||||
EJS_DISABLE_BATCH_BOOTUP: boolean;
|
||||
EJS_NETPLAY_ENABLED: boolean;
|
||||
EJS_NETPLAY_ICE_SERVERS: Array<NetplayICEServer>;
|
||||
EJS_SETTINGS: Record<string, Record<string, string>>;
|
||||
|
||||
@@ -435,9 +435,16 @@ async function boot() {
|
||||
window.EJS_language = selectedLanguage.value.value.replace("_", "-");
|
||||
window.EJS_disableAutoLang = true;
|
||||
|
||||
const { EJS_DEBUG, EJS_CACHE_LIMIT } = configStore.config;
|
||||
if (EJS_CACHE_LIMIT !== null) window.EJS_CacheLimit = EJS_CACHE_LIMIT;
|
||||
const {
|
||||
EJS_DEBUG,
|
||||
EJS_CACHE_LIMIT,
|
||||
EJS_DISABLE_AUTO_UNLOAD,
|
||||
EJS_DISABLE_BATCH_BOOTUP,
|
||||
} = configStore.config;
|
||||
window.EJS_DEBUG_XX = EJS_DEBUG;
|
||||
window.EJS_disableAutoUnload = EJS_DISABLE_AUTO_UNLOAD;
|
||||
window.EJS_disableBatchBootup = EJS_DISABLE_BATCH_BOOTUP;
|
||||
if (EJS_CACHE_LIMIT !== null) window.EJS_CacheLimit = EJS_CACHE_LIMIT;
|
||||
|
||||
// Set a valid game name (affects per-game settings keys)
|
||||
window.EJS_gameName = rom.fs_name_no_tags
|
||||
|
||||
@@ -26,6 +26,8 @@ const defaultConfig = {
|
||||
EJS_DEBUG: false,
|
||||
EJS_NETPLAY_ENABLED: false,
|
||||
EJS_CACHE_LIMIT: null,
|
||||
EJS_DISABLE_AUTO_UNLOAD: false,
|
||||
EJS_DISABLE_BATCH_BOOTUP: false,
|
||||
EJS_NETPLAY_ICE_SERVERS: [],
|
||||
EJS_SETTINGS: {},
|
||||
EJS_CONTROLS: {},
|
||||
|
||||
@@ -68,6 +68,7 @@ declare global {
|
||||
EJS_gameName: string;
|
||||
EJS_backgroundImage: string;
|
||||
EJS_backgroundColor: string;
|
||||
EJS_backgroundBlur: boolean;
|
||||
EJS_gameUrl: string;
|
||||
EJS_loadStateURL: string | null;
|
||||
EJS_cheats: string;
|
||||
@@ -89,6 +90,21 @@ declare global {
|
||||
EJS_CacheLimit: number;
|
||||
EJS_Buttons: Record<string, boolean>;
|
||||
EJS_VirtualGamepadSettings: Record<string, unknown>;
|
||||
EJS_volume: number;
|
||||
EJS_paths: Record<string, string>;
|
||||
EJS_startButtonName: string;
|
||||
EJS_softLoad: boolean;
|
||||
EJS_screenCapture: object;
|
||||
EJS_externalFiles: Record<string, string>;
|
||||
EJS_videoRotation: number;
|
||||
EJS_fixedSaveInterval: number;
|
||||
EJS_disableCue: boolean;
|
||||
EJS_dontExtractRom: boolean;
|
||||
EJS_dontExtractBIOS: boolean;
|
||||
EJS_disableDatabases: boolean;
|
||||
EJS_disableLocalStorage: boolean;
|
||||
EJS_disableAutoUnload: boolean;
|
||||
EJS_disableBatchBootup: boolean;
|
||||
EJS_onGameStart: () => void;
|
||||
EJS_onSaveState: (args: {
|
||||
screenshot: ArrayBuffer;
|
||||
@@ -147,6 +163,8 @@ window.EJS_disableAutoLang = true;
|
||||
const {
|
||||
EJS_DEBUG,
|
||||
EJS_CACHE_LIMIT,
|
||||
EJS_DISABLE_AUTO_UNLOAD,
|
||||
EJS_DISABLE_BATCH_BOOTUP,
|
||||
EJS_NETPLAY_ICE_SERVERS,
|
||||
EJS_NETPLAY_ENABLED,
|
||||
} = configStore.config;
|
||||
@@ -154,8 +172,10 @@ window.EJS_netplayServer = EJS_NETPLAY_ENABLED ? window.location.host : "";
|
||||
window.EJS_netplayICEServers = EJS_NETPLAY_ENABLED
|
||||
? EJS_NETPLAY_ICE_SERVERS
|
||||
: [];
|
||||
if (EJS_CACHE_LIMIT !== null) window.EJS_CacheLimit = EJS_CACHE_LIMIT;
|
||||
window.EJS_DEBUG_XX = EJS_DEBUG;
|
||||
window.EJS_disableAutoUnload = EJS_DISABLE_AUTO_UNLOAD;
|
||||
window.EJS_disableBatchBootup = EJS_DISABLE_BATCH_BOOTUP;
|
||||
if (EJS_CACHE_LIMIT !== null) window.EJS_CacheLimit = EJS_CACHE_LIMIT;
|
||||
|
||||
onMounted(() => {
|
||||
window.scrollTo(0, 0);
|
||||
|
||||
Reference in New Issue
Block a user