-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Region setting for emulator labels
- add "emulators_list.db" database which contains directory names, emulator names (depending the region), manufacturer, release date, ... It will be a database to maintain to allow quick renaming via System Tools. - add scripts which allow to rename all the emulators in one click This database will be used to offer the possibility to the user to select the kind of emulator label he want: https://docs.google.com/spreadsheets/d/1sSi6PamSL6nHU3nORooms9AjNKYcoGGDZNJbUkF-sa0/edit?usp=sharing For example US users want "Genesis" and EU want "Mega Drive". Do not hesitate to post an issue if there are errors. For each US/EU/JP there is a full name and a short name. The short name will be used to prefix with manufacturer name (and group the emulators by manufacturer). For example you'll have the choice between: - if you're from EU: Mega Drive or Seg. MD - if you're from US: Genesis or Seg. Gen. The current type of emulator label is kept in crossmix.json as "EMU LABELS". These emulator rename scripts will be used later by CrossMix "Theme Pack Selector".
- Loading branch information
Showing
13 changed files
with
544 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
Apps/SystemTools/Menu/ADVANCED SETTINGS##EMULATOR LABELS (value)/Console Full Name - EU.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/sh | ||
|
||
# Export necessary environment variables | ||
export PATH="/mnt/SDCARD/System/bin:$PATH" | ||
export LD_LIBRARY_PATH="/mnt/SDCARD/System/lib:/usr/trimui/lib:$LD_LIBRARY_PATH" | ||
|
||
# Display a message indicating the application of default icons | ||
/mnt/SDCARD/System/usr/trimui/scripts/infoscreen.sh -m "Applying \"$(basename "$0" .sh)\" icons by default..." | ||
|
||
# Get the script name without the extension | ||
script_name=$(basename "$0" .sh) | ||
|
||
# Path to the SQLite database | ||
db_path="/mnt/SDCARD/System/usr/trimui/scripts/emulators_list.db" | ||
|
||
# Iterate over all directories in /mnt/SDCARD/Emus/ | ||
for dir in /mnt/SDCARD/Emus/*/; do | ||
folder_name=$(basename "$dir") | ||
# Skip directories starting with an underscore | ||
if [[ "$folder_name" == _* ]]; then | ||
echo "Skipping $folder_name" | ||
continue | ||
fi | ||
config_file="${dir}config.json" | ||
if [ -f "$config_file" ]; then | ||
# Retrieve the trimui_name_full_EU from the database | ||
trimui_name_full_EU=$(sqlite3 "$db_path" "SELECT trimui_name_full_EU FROM systems WHERE crossmix_foldername = '$folder_name'") | ||
if [ -n "$trimui_name_full_EU" ]; then | ||
# Update the label value in the JSON file | ||
/mnt/SDCARD/System/bin/jq --arg new_label "$trimui_name_full_EU" '.label = $new_label' "$config_file" > /tmp/tmp_config.json && mv /tmp/tmp_config.json "$config_file" | ||
echo "Updated label in $folder_name to \"$trimui_name_full_EU\"" | ||
else | ||
echo "No trimui_name_full_EU found for folder $folder_name" | ||
fi | ||
fi | ||
done | ||
|
||
# Check for the existence of crossmix.json and update it | ||
json_file="/mnt/SDCARD/System/etc/crossmix.json" | ||
if [ ! -f "$json_file" ]; then | ||
echo "{}" >"$json_file" | ||
fi | ||
/mnt/SDCARD/System/bin/jq --arg script_name "$script_name" '. += {"EMU LABELS": $script_name}' "$json_file" >"/tmp/json_file.tmp" && mv "/tmp/json_file.tmp" "$json_file" | ||
|
||
# Update the SQLite database | ||
database_file="/mnt/SDCARD/Apps/SystemTools/Menu/Menu_cache7.db" | ||
sqlite3 "$database_file" <<EOF | ||
UPDATE Menu_roms SET disp = 'EMULATOR LABELS ($script_name)', pinyin = 'EMULATOR LABELS ($script_name)', cpinyin = 'EMULATOR LABELS ($script_name)', opinyin = 'EMULATOR LABELS ($script_name)' WHERE disp LIKE 'EMULATOR LABELS (%)'; | ||
UPDATE Menu_roms SET ppath = 'EMULATOR LABELS ($script_name)' WHERE ppath LIKE 'EMULATOR LABELS (%)'; | ||
EOF | ||
|
||
# Update the state.json file if it exists | ||
json_file="/tmp/state.json" | ||
if [ -f "$json_file" ]; then | ||
/mnt/SDCARD/System/bin/jq --arg script_name "$script_name" '.list |= map(if (.ppath | index("EMULATOR LABELS ")) then .ppath = "EMULATOR LABELS (\($script_name))" else . end)' "$json_file" > "$json_file.tmp" && mv "$json_file.tmp" "$json_file" | ||
fi | ||
|
||
# Synchronize the filesystem | ||
sync | ||
sleep 0.1 | ||
|
||
# Labels has changed so the Emulator selection must be done again: | ||
/mnt/SDCARD/Apps/EmuCleaner/launch.sh -s |
64 changes: 64 additions & 0 deletions
64
Apps/SystemTools/Menu/ADVANCED SETTINGS##EMULATOR LABELS (value)/Console Full Name - US.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/sh | ||
|
||
# Export necessary environment variables | ||
export PATH="/mnt/SDCARD/System/bin:$PATH" | ||
export LD_LIBRARY_PATH="/mnt/SDCARD/System/lib:/usr/trimui/lib:$LD_LIBRARY_PATH" | ||
|
||
# Display a message indicating the application of default icons | ||
/mnt/SDCARD/System/usr/trimui/scripts/infoscreen.sh -m "Applying \"$(basename "$0" .sh)\" icons by default..." | ||
|
||
# Get the script name without the extension | ||
script_name=$(basename "$0" .sh) | ||
|
||
# Path to the SQLite database | ||
db_path="/mnt/SDCARD/System/usr/trimui/scripts/emulators_list.db" | ||
|
||
# Iterate over all directories in /mnt/SDCARD/Emus/ | ||
for dir in /mnt/SDCARD/Emus/*/; do | ||
folder_name=$(basename "$dir") | ||
# Skip directories starting with an underscore | ||
if [[ "$folder_name" == _* ]]; then | ||
echo "Skipping $folder_name" | ||
continue | ||
fi | ||
|
||
config_file="${dir}config.json" | ||
if [ -f "$config_file" ]; then | ||
# Retrieve the trimui_name_full_US from the database | ||
trimui_name_full_US=$(sqlite3 "$db_path" "SELECT trimui_name_full_US FROM systems WHERE crossmix_foldername = '$folder_name'") | ||
if [ -n "$trimui_name_full_US" ]; then | ||
# Update the label value in the JSON file | ||
/mnt/SDCARD/System/bin/jq --arg new_label "$trimui_name_full_US" '.label = $new_label' "$config_file" > /tmp/tmp_config.json && mv /tmp/tmp_config.json "$config_file" | ||
echo "Updated label in $folder_name to \"$trimui_name_full_US\"" | ||
else | ||
echo "No trimui_name_full_US found for folder $folder_name" | ||
fi | ||
fi | ||
done | ||
|
||
# Check for the existence of crossmix.json and update it | ||
json_file="/mnt/SDCARD/System/etc/crossmix.json" | ||
if [ ! -f "$json_file" ]; then | ||
echo "{}" >"$json_file" | ||
fi | ||
/mnt/SDCARD/System/bin/jq --arg script_name "$script_name" '. += {"EMU LABELS": $script_name}' "$json_file" >"/tmp/json_file.tmp" && mv "/tmp/json_file.tmp" "$json_file" | ||
|
||
# Update the SQLite database | ||
database_file="/mnt/SDCARD/Apps/SystemTools/Menu/Menu_cache7.db" | ||
sqlite3 "$database_file" <<EOF | ||
UPDATE Menu_roms SET disp = 'EMULATOR LABELS ($script_name)', pinyin = 'EMULATOR LABELS ($script_name)', cpinyin = 'EMULATOR LABELS ($script_name)', opinyin = 'EMULATOR LABELS ($script_name)' WHERE disp LIKE 'EMULATOR LABELS (%)'; | ||
UPDATE Menu_roms SET ppath = 'EMULATOR LABELS ($script_name)' WHERE ppath LIKE 'EMULATOR LABELS (%)'; | ||
EOF | ||
|
||
# Update the state.json file if it exists | ||
json_file="/tmp/state.json" | ||
if [ -f "$json_file" ]; then | ||
/mnt/SDCARD/System/bin/jq --arg script_name "$script_name" '.list |= map(if (.ppath | index("EMULATOR LABELS ")) then .ppath = "EMULATOR LABELS (\($script_name))" else . end)' "$json_file" > "$json_file.tmp" && mv "$json_file.tmp" "$json_file" | ||
fi | ||
|
||
# Synchronize the filesystem | ||
sync | ||
sleep 0.1 | ||
|
||
# Labels has changed so the Emulator selection must be done again: | ||
/mnt/SDCARD/Apps/EmuCleaner/launch.sh -s |
64 changes: 64 additions & 0 deletions
64
Apps/SystemTools/Menu/ADVANCED SETTINGS##EMULATOR LABELS (value)/Console Short Name - EU.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/sh | ||
|
||
# Export necessary environment variables | ||
export PATH="/mnt/SDCARD/System/bin:$PATH" | ||
export LD_LIBRARY_PATH="/mnt/SDCARD/System/lib:/usr/trimui/lib:$LD_LIBRARY_PATH" | ||
|
||
# Display a message indicating the application of default icons | ||
/mnt/SDCARD/System/usr/trimui/scripts/infoscreen.sh -m "Applying \"$(basename "$0" .sh)\" icons by default..." | ||
|
||
# Get the script name without the extension | ||
script_name=$(basename "$0" .sh) | ||
|
||
# Path to the SQLite database | ||
db_path="/mnt/SDCARD/System/usr/trimui/scripts/emulators_list.db" | ||
|
||
# Iterate over all directories in /mnt/SDCARD/Emus/ | ||
for dir in /mnt/SDCARD/Emus/*/; do | ||
folder_name=$(basename "$dir") | ||
# Skip directories starting with an underscore | ||
if [[ "$folder_name" == _* ]]; then | ||
echo "Skipping $folder_name" | ||
continue | ||
fi | ||
|
||
config_file="${dir}config.json" | ||
if [ -f "$config_file" ]; then | ||
# Retrieve the trimui_name_short_EU from the database | ||
trimui_name_short_EU=$(sqlite3 "$db_path" "SELECT trimui_name_short_EU FROM systems WHERE crossmix_foldername = '$folder_name'") | ||
if [ -n "$trimui_name_short_EU" ]; then | ||
# Update the label value in the JSON file | ||
/mnt/SDCARD/System/bin/jq --arg new_label "$trimui_name_short_EU" '.label = $new_label' "$config_file" > /tmp/tmp_config.json && mv /tmp/tmp_config.json "$config_file" | ||
echo "Updated label in $folder_name to \"$trimui_name_short_EU\"" | ||
else | ||
echo "No trimui_name_short_EU found for folder $folder_name" | ||
fi | ||
fi | ||
done | ||
|
||
# Check for the existence of crossmix.json and update it | ||
json_file="/mnt/SDCARD/System/etc/crossmix.json" | ||
if [ ! -f "$json_file" ]; then | ||
echo "{}" >"$json_file" | ||
fi | ||
/mnt/SDCARD/System/bin/jq --arg script_name "$script_name" '. += {"EMU LABELS": $script_name}' "$json_file" >"/tmp/json_file.tmp" && mv "/tmp/json_file.tmp" "$json_file" | ||
|
||
# Update the SQLite database | ||
database_file="/mnt/SDCARD/Apps/SystemTools/Menu/Menu_cache7.db" | ||
sqlite3 "$database_file" <<EOF | ||
UPDATE Menu_roms SET disp = 'EMULATOR LABELS ($script_name)', pinyin = 'EMULATOR LABELS ($script_name)', cpinyin = 'EMULATOR LABELS ($script_name)', opinyin = 'EMULATOR LABELS ($script_name)' WHERE disp LIKE 'EMULATOR LABELS (%)'; | ||
UPDATE Menu_roms SET ppath = 'EMULATOR LABELS ($script_name)' WHERE ppath LIKE 'EMULATOR LABELS (%)'; | ||
EOF | ||
|
||
# Update the state.json file if it exists | ||
json_file="/tmp/state.json" | ||
if [ -f "$json_file" ]; then | ||
/mnt/SDCARD/System/bin/jq --arg script_name "$script_name" '.list |= map(if (.ppath | index("EMULATOR LABELS ")) then .ppath = "EMULATOR LABELS (\($script_name))" else . end)' "$json_file" > "$json_file.tmp" && mv "$json_file.tmp" "$json_file" | ||
fi | ||
|
||
# Synchronize the filesystem | ||
sync | ||
sleep 0.1 | ||
|
||
# Labels has changed so the Emulator selection must be done again: | ||
/mnt/SDCARD/Apps/EmuCleaner/launch.sh -s |
64 changes: 64 additions & 0 deletions
64
Apps/SystemTools/Menu/ADVANCED SETTINGS##EMULATOR LABELS (value)/Console Short Name - US.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/sh | ||
|
||
# Export necessary environment variables | ||
export PATH="/mnt/SDCARD/System/bin:$PATH" | ||
export LD_LIBRARY_PATH="/mnt/SDCARD/System/lib:/usr/trimui/lib:$LD_LIBRARY_PATH" | ||
|
||
# Display a message indicating the application of default icons | ||
/mnt/SDCARD/System/usr/trimui/scripts/infoscreen.sh -m "Applying \"$(basename "$0" .sh)\" icons by default..." | ||
|
||
# Get the script name without the extension | ||
script_name=$(basename "$0" .sh) | ||
|
||
# Path to the SQLite database | ||
db_path="/mnt/SDCARD/System/usr/trimui/scripts/emulators_list.db" | ||
|
||
# Iterate over all directories in /mnt/SDCARD/Emus/ | ||
for dir in /mnt/SDCARD/Emus/*/; do | ||
folder_name=$(basename "$dir") | ||
# Skip directories starting with an underscore | ||
if [[ "$folder_name" == _* ]]; then | ||
echo "Skipping $folder_name" | ||
continue | ||
fi | ||
|
||
config_file="${dir}config.json" | ||
if [ -f "$config_file" ]; then | ||
# Retrieve the trimui_name_short_US from the database | ||
trimui_name_short_US=$(sqlite3 "$db_path" "SELECT trimui_name_short_US FROM systems WHERE crossmix_foldername = '$folder_name'") | ||
if [ -n "$trimui_name_short_US" ]; then | ||
# Update the label value in the JSON file | ||
/mnt/SDCARD/System/bin/jq --arg new_label "$trimui_name_short_US" '.label = $new_label' "$config_file" > /tmp/tmp_config.json && mv /tmp/tmp_config.json "$config_file" | ||
echo "Updated label in $folder_name to \"$trimui_name_short_US\"" | ||
else | ||
echo "No trimui_name_short_US found for folder $folder_name" | ||
fi | ||
fi | ||
done | ||
|
||
# Check for the existence of crossmix.json and update it | ||
json_file="/mnt/SDCARD/System/etc/crossmix.json" | ||
if [ ! -f "$json_file" ]; then | ||
echo "{}" >"$json_file" | ||
fi | ||
/mnt/SDCARD/System/bin/jq --arg script_name "$script_name" '. += {"EMU LABELS": $script_name}' "$json_file" >"/tmp/json_file.tmp" && mv "/tmp/json_file.tmp" "$json_file" | ||
|
||
# Update the SQLite database | ||
database_file="/mnt/SDCARD/Apps/SystemTools/Menu/Menu_cache7.db" | ||
sqlite3 "$database_file" <<EOF | ||
UPDATE Menu_roms SET disp = 'EMULATOR LABELS ($script_name)', pinyin = 'EMULATOR LABELS ($script_name)', cpinyin = 'EMULATOR LABELS ($script_name)', opinyin = 'EMULATOR LABELS ($script_name)' WHERE disp LIKE 'EMULATOR LABELS (%)'; | ||
UPDATE Menu_roms SET ppath = 'EMULATOR LABELS ($script_name)' WHERE ppath LIKE 'EMULATOR LABELS (%)'; | ||
EOF | ||
|
||
# Update the state.json file if it exists | ||
json_file="/tmp/state.json" | ||
if [ -f "$json_file" ]; then | ||
/mnt/SDCARD/System/bin/jq --arg script_name "$script_name" '.list |= map(if (.ppath | index("EMULATOR LABELS ")) then .ppath = "EMULATOR LABELS (\($script_name))" else . end)' "$json_file" > "$json_file.tmp" && mv "$json_file.tmp" "$json_file" | ||
fi | ||
|
||
# Synchronize the filesystem | ||
sync | ||
sleep 0.1 | ||
|
||
# Labels has changed so the Emulator selection must be done again: | ||
/mnt/SDCARD/Apps/EmuCleaner/launch.sh -s |
61 changes: 61 additions & 0 deletions
61
Apps/SystemTools/Menu/ADVANCED SETTINGS##EMULATOR LABELS (value)/Default.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/sh | ||
|
||
# Export necessary environment variables | ||
export PATH="/mnt/SDCARD/System/bin:$PATH" | ||
export LD_LIBRARY_PATH="/mnt/SDCARD/System/lib:/usr/trimui/lib:$LD_LIBRARY_PATH" | ||
|
||
# Display a message indicating the application of default icons | ||
/mnt/SDCARD/System/usr/trimui/scripts/infoscreen.sh -m "Applying \"$(basename "$0" .sh)\" icons by default..." | ||
|
||
# Get the script name without the extension | ||
script_name=$(basename "$0" .sh) | ||
|
||
# Path to the SQLite database | ||
db_path="/mnt/SDCARD/System/usr/trimui/scripts/emulators_list.db" | ||
|
||
# Iterate over all config.json files in /mnt/SDCARD/Emus/ and set the label from the database | ||
find /mnt/SDCARD/Emus/ -type d -exec sh -c ' | ||
for dir do | ||
config_file="$dir/config.json" | ||
if [ -f "$config_file" ]; then | ||
folder_name=$(basename "$dir") | ||
# Retrieve the crossmix_name from the database | ||
crossmix_name=$(sqlite3 '"$db_path"' "SELECT crossmix_name FROM systems WHERE crossmix_foldername = \"$folder_name\"") | ||
if [ -n "$crossmix_name" ]; then | ||
# Update the label value in the JSON file | ||
/mnt/SDCARD/System/bin/jq --arg new_label "$crossmix_name" ".label = \$new_label" "$config_file" > /tmp/tmp_config.json && mv /tmp/tmp_config.json "$config_file" | ||
echo "Updated label in $folder_name to $crossmix_name" | ||
else | ||
echo "No crossmix_name found for folder $folder_name" | ||
fi | ||
fi | ||
done | ||
' sh {} + | ||
|
||
# Check for the existence of crossmix.json and update it | ||
json_file="/mnt/SDCARD/System/etc/crossmix.json" | ||
if [ ! -f "$json_file" ]; then | ||
echo "{}" >"$json_file" | ||
fi | ||
/mnt/SDCARD/System/bin/jq --arg script_name "$script_name" '. += {"EMU LABELS": $script_name}' "$json_file" >"/tmp/json_file.tmp" && mv "/tmp/json_file.tmp" "$json_file" | ||
|
||
# Update the SQLite database | ||
database_file="/mnt/SDCARD/Apps/SystemTools/Menu/Menu_cache7.db" | ||
sqlite3 "$database_file" <<EOF | ||
UPDATE Menu_roms SET disp = 'EMULATOR LABELS ($script_name)', pinyin = 'EMULATOR LABELS ($script_name)', cpinyin = 'EMULATOR LABELS ($script_name)', opinyin = 'EMULATOR LABELS ($script_name)' WHERE disp LIKE 'EMULATOR LABELS (%)'; | ||
UPDATE Menu_roms SET ppath = 'EMULATOR LABELS ($script_name)' WHERE ppath LIKE 'EMULATOR LABELS (%)'; | ||
EOF | ||
|
||
# Update the state.json file if it exists | ||
json_file="/tmp/state.json" | ||
if [ -f "$json_file" ]; then | ||
/mnt/SDCARD/System/bin/jq --arg script_name "$script_name" '.list |= map(if (.ppath | index("EMULATOR LABELS ")) then .ppath = "EMULATOR LABELS (\($script_name))" else . end)' "$json_file" > "$json_file.tmp" && mv "$json_file.tmp" "$json_file" | ||
fi | ||
|
||
# Synchronize the filesystem | ||
sync | ||
sleep 0.1 | ||
|
||
# Labels has changed so the Emulator selection must be done again: | ||
/mnt/SDCARD/Apps/EmuCleaner/launch.sh -s |
Oops, something went wrong.