Skip to content

Commit

Permalink
- Add remaining N64 bases
Browse files Browse the repository at this point in the history
- Capped N64 ROM limit to 64MB for ROMC revisions
- Fix incorrect LibRetro database ordering
- Fix renamed projects not saving properly
- Update interface and language strings (yet again)
  • Loading branch information
CatmanFan committed Jan 27, 2025
1 parent 186f8a5 commit 8374f61
Show file tree
Hide file tree
Showing 16 changed files with 177 additions and 111 deletions.
50 changes: 40 additions & 10 deletions FriishProduce/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,16 @@ private void RefreshForm()
(tabPage.Form as ProjectForm).RefreshForm();
}

public void UpdateConfig()
{
foreach (JacksiroKe.MdiTabCtrl.TabPage tabPage in tabControl.TabPages)
if (tabPage.Form.GetType() == typeof(ProjectForm))
{
(tabPage.Form as ProjectForm).use_online_wad.Enabled = Program.Config.application.use_online_wad_enabled;
if (!(tabPage.Form as ProjectForm).use_online_wad.Enabled) (tabPage.Form as ProjectForm).use_online_wad.Checked = false;
}
}

public MainForm(string[] files = null)
{
InitializeComponent();
Expand Down Expand Up @@ -308,7 +318,7 @@ public void TabChanged(object sender, EventArgs e)
if (!hasTabs)
{
game_scan.Enabled = false;
save_project.Enabled = save_project_as.Enabled = false;
save_project_as.Enabled = save_project.Enabled = false;
export.Enabled = false;
toolbarImportGameFile.Image = Properties.Resources.page_white_cd;
import_game_file.Text = string.Format(Program.Lang.String(import_game_file.Tag.ToString(), Name), Program.Lang.String("rom_label1", "projectform"));
Expand All @@ -319,7 +329,7 @@ public void TabChanged(object sender, EventArgs e)
else
{
game_scan.Enabled = (tabControl.SelectedForm as ProjectForm).ToolbarButtons[0];
save_project.Enabled = save_project_as.Enabled = (tabControl.SelectedForm as ProjectForm).IsModified;
save_project_as.Enabled = save_project.Enabled = (tabControl.SelectedForm as ProjectForm).IsModified;
export.Enabled = (tabControl.SelectedForm as ProjectForm).IsExportable;
toolbarImportGameFile.Image = (tabControl.SelectedForm as ProjectForm).FileTypeImage;
import_game_file.Text = string.Format(Program.Lang.String(import_game_file.Tag.ToString(), Name), (tabControl.SelectedForm as ProjectForm).FileTypeName);
Expand Down Expand Up @@ -428,44 +438,62 @@ private void ExportWAD_Click(object sender, EventArgs e)
currentForm?.SaveToWAD(SaveWAD.FileName);
}

private void SaveAs_Click(object sender, EventArgs e) => SaveAs_Trigger();
private void SaveAs_Click(object sender, EventArgs e) => SaveAs_Trigger(tabControl.SelectedForm as Form);

public bool SaveAs_Trigger()
public bool SaveAs_Trigger(Form form)
{
try
{
if (tabControl.SelectedForm is not ProjectForm currentForm) return false;
if (form is not ProjectForm) return false;

SaveProject.FileName =
Path.GetFileNameWithoutExtension((form as ProjectForm).ProjectPath) ??
(form as ProjectForm)?.GetName(false) ??
(form as ProjectForm).Text;

SaveProject.FileName = Path.GetFileNameWithoutExtension(currentForm.ProjectPath) ?? currentForm?.GetName(false) ?? currentForm.Text;
foreach (var item in new char[] { '\\', '/', ':', '*', '?', '"', '<', '>', '|' })
SaveProject.FileName = SaveProject.FileName.Replace(item, '_');

if (SaveProject.ShowDialog() == DialogResult.OK)
{
currentForm.SaveProject(SaveProject.FileName);
(form as ProjectForm).SaveProject(SaveProject.FileName);
return true;
}
}

catch (Exception ex)
{
MessageBox.Show("Could not save!", ex.Message, MessageBox.Buttons.Ok, MessageBox.Icons.Error);
MessageBox.Show(string.Format(Program.Lang.Msg(18, true), form.Text), ex.Message, MessageBox.Buttons.Ok);
}

return false;
}

private void SaveAll_Click(object sender, EventArgs e)
{
List<ProjectForm> list = new();

for (int i = 0; i < tabControl.TabPages.Count; i++)
list.Add(tabControl.TabPages[i].Form as ProjectForm);

foreach (var tab in list)
{
try { if (File.Exists(tab.ProjectPath)) tab.SaveProject(tab.ProjectPath); else SaveAs_Trigger(tab); }
catch (Exception ex) { MessageBox.Show(string.Format(Program.Lang.Msg(18, true), tab.Text), ex.Message, MessageBox.Buttons.Ok); }
}
}

private void Save_Click(object sender, EventArgs e)
{
if (tabControl.SelectedForm is not ProjectForm currentForm) return;

if (File.Exists(currentForm.ProjectPath))
{
try { currentForm.SaveProject(currentForm.ProjectPath); }
catch (Exception ex) { MessageBox.Show("Could not save!", ex.Message, MessageBox.Buttons.Ok, MessageBox.Icons.Error); }
catch (Exception ex) { MessageBox.Show(string.Format(Program.Lang.Msg(18, true), currentForm.Text), ex.Message, MessageBox.Buttons.Ok); }
}

else SaveAs_Trigger();
else SaveAs_Trigger(currentForm);
}

private void OpenProject_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -563,6 +591,8 @@ private void OpenProject(string[] files)
var binaryFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
project = (Project)binaryFormatter.Deserialize(stream);

if (project.ProjectPath != file) project.ProjectPath = file;

addTab(project.Platform, project);
}

Expand Down
3 changes: 3 additions & 0 deletions FriishProduce/MainForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,9 @@
<data name="close_all.Enabled" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="close_all.Shortcut" type="System.Windows.Forms.Shortcut, System.Windows.Forms">
<value>CtrlShiftF4</value>
</data>
<data name="close_all.Text" xml:space="preserve">
<value>close_all</value>
</data>
Expand Down
2 changes: 1 addition & 1 deletion FriishProduce/ProjectForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 12 additions & 5 deletions FriishProduce/ProjectForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ private void Form_Shown(object sender, EventArgs e)

public void BrowseROMDialog(string text)
{
browseROM.Title = text;
browseROM.Title = text.Replace("&", "");

if (browseROM.ShowDialog() == DialogResult.OK)
{
Expand All @@ -923,7 +923,7 @@ public void BrowseROMDialog(string text)

public void BrowseImageDialog()
{
browseImage.Title = import_image.Text;
browseImage.Title = import_image.Text.Replace("&", "");
browseImage.Filter = Program.Lang.String("filter.img");

if (browseImage.ShowDialog() == DialogResult.OK) LoadImage(browseImage.FileName);
Expand Down Expand Up @@ -1039,9 +1039,15 @@ private void randomTID()
public string GetName(bool full)
{
string FILENAME = File.Exists(patch) ? Path.GetFileNameWithoutExtension(patch) : Path.GetFileNameWithoutExtension(rom?.FilePath);

string CHANNELNAME = channel_name.Text;
if (string.IsNullOrWhiteSpace(CHANNELNAME)) CHANNELNAME = Untitled;

string FULLNAME = System.Text.RegularExpressions.Regex.Replace(_bannerTitle, @"\((.*?)\)", "").Replace("\r\n", "\n").Replace("\n", " - ");
if (string.IsNullOrWhiteSpace(FULLNAME)) FULLNAME = Untitled;

string TITLEID = title_id_upper.Text.ToUpper();

string PLATFORM = targetPlatform.ToString();

string REGION = regions.SelectedItem.ToString() == Program.Lang.String("region_j") ? "Japan"
Expand Down Expand Up @@ -1071,6 +1077,7 @@ public string GetName(bool full)

string target = full ? Program.Config.application.default_export_filename : Program.Config.application.default_target_filename;
target = target.Replace("FILENAME", FILENAME).Replace("CHANNELNAME", CHANNELNAME).Replace("FULLNAME", FULLNAME).Replace("TITLEID", TITLEID).Replace("PLATFORM", PLATFORM).Replace("REGION", REGION);
if (target == Untitled) target = "";

return string.Join("_", target.Split(Path.GetInvalidFileNameChars(), StringSplitOptions.RemoveEmptyEntries));
}
Expand Down Expand Up @@ -1113,7 +1120,7 @@ public bool CheckUnsaved()
SaveProject(ProjectPath);
return true;
}
else return Program.MainForm.SaveAs_Trigger();
else return Program.MainForm.SaveAs_Trigger(this);
}

else if (result == MessageBox.Result.Button2)
Expand Down Expand Up @@ -1210,7 +1217,7 @@ private void OpenWAD_CheckedChanged(object sender, EventArgs e)

private void import_wad_Click(object sender, EventArgs e)
{
browseInputWad.Title = import_wad.Text;
browseInputWad.Title = import_wad.Text.Replace("&", "");
browseInputWad.Filter = Program.Lang.String("filter.wad");
var result = browseInputWad.ShowDialog();

Expand Down Expand Up @@ -2339,7 +2346,7 @@ private void play_banner_sound_Click(object sender, EventArgs e)
private void replace_banner_sound_Click(object sender, EventArgs e)
{
browseSound.Filter = "WAV (*.wav)|*.wav" + Program.Lang.String("filter");
browseSound.Title = replace_banner_sound.Text;
browseSound.Title = replace_banner_sound.Text.Replace("&", "");
if (browseSound.ShowDialog() == DialogResult.OK || File.Exists(browseSound.FileName))
LoadSound(browseSound.FileName);
}
Expand Down
6 changes: 5 additions & 1 deletion FriishProduce/SettingsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ private void OK_Click(object sender, EventArgs e)
// -------------------------------------------
// Other settings
// -------------------------------------------


bool toggledOnline = Program.Config.application.use_online_wad_enabled != use_online_wad_enabled.Checked;
Program.Config.application.image_interpolation = image_interpolation_modes.SelectedIndex;
Program.Config.application.use_online_wad_enabled = use_online_wad_enabled.Checked;
Program.Config.application.bypass_rom_size = bypass_rom_size.Checked;
Expand Down Expand Up @@ -454,6 +455,9 @@ private void OK_Click(object sender, EventArgs e)
|| dirtyOption2 != reset_all_dialogs.Checked);
if (isDirty) MessageBox.Show(Program.Lang.Msg(0), MessageBox.Buttons.Ok, MessageBox.Icons.Information);

if (toggledOnline)
Program.MainForm.UpdateConfig();

isShown = false;
DialogResult = DialogResult.OK;
}
Expand Down
3 changes: 2 additions & 1 deletion FriishProduce/Strings/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
"e_015": "Failed to create savedata TPL.",
"e_016": "No Virtual Console manual was found in the provided WAD.",
"e_017": "\"{0}\" is not a valid project file.",
"e_018": "Unable to save {0}."
},

"html": {
Expand Down Expand Up @@ -164,7 +165,7 @@
"save_project": "&Save project",
"save_project_as": "Save &project as...",
"close_project": "&Close project",
"close_all": "Close &all",
"close_all": "Close all",

"import_game_file": "&Import {0}...",
"game_scan": "&Fill in game data",
Expand Down
5 changes: 3 additions & 2 deletions FriishProduce/Strings/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@
"e_014": "No se encontró el archivo BIOS necesario para esta consola.\nPor favor seleccione un archivo en los ajustes de la aplicación.",
"e_015": "No se pudo crear la imagen TPL para los datos guardados.",
"e_016": "No se encontró ningún manual electrónico de Consola Virtual.",
"e_017": "\"{0}\" no es un archivo de proyecto válido."
"e_017": "\"{0}\" no es un archivo de proyecto válido.",
"e_018": "No se pudo guardar el proyecto \"{0}\"."
},

"html": {
Expand Down Expand Up @@ -161,7 +162,7 @@
"save_project": "&Guardar proyecto",
"save_project_as": "Guardar &proyecto como...",
"close_project": "&Cerrar proyecto",
"close_all": "Cerrar &todo",
"close_all": "Cerrar todo",

"import_game_file": "&Abrir un archivo de juego...",
"game_scan": "&Obtener datos del juego de la base de datos en línea",
Expand Down
5 changes: 3 additions & 2 deletions FriishProduce/Strings/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@
"e_014": "Le fichier BIOS requis pour cette console est indisponible. Veuillez le spécifier de nouveau dans les préférences de l'application.",
"e_015": "Échec de création de l'image d'aperçu des données de sauvegarde.",
"e_016": "Aucun mode d'emploi de Console virtuelle n'a été trouvé dans cette chaîne.",
"e_017": "«{0}» n'est pas un fichier de projet valide."
"e_017": "«{0}» n'est pas un fichier de projet valide.",
"e_018": "«{0}» ne peut pas être enregistré."
},

"html": {
Expand Down Expand Up @@ -161,7 +162,7 @@
"save_project": "&Enregistrer le projet",
"save_project_as": "Enregistrer le projet &sous ...",
"close_project": "&Fermer le projet",
"close_all": "Fermer &tous les projets",
"close_all": "Fermer tout",

"import_game_file": "&Ouvrir un fichier {0} ...",
"game_scan": "&Charger les informations dès de la bibliothèque des jeux",
Expand Down
5 changes: 3 additions & 2 deletions FriishProduce/Strings/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@
"e_014": "このゲーム機の必要なBIOSファイルは見つかりませんでした。\n\nこのファイルをアプリの設定で指定してください。",
"e_015": "セーブデータ用のTPLファイルを作成できませんでした。",
"e_016": "このWADにはVCの説明書がありません。",
"e_017": "「{0}」は有効なプロジェクトファイルではありません。"
"e_017": "「{0}」は有効なプロジェクトファイルではありません。",
"e_018": "「{0}」を保存できません。"
},
"html": {
"l_000": "Frodoエミュレーターが開きます。\n\n① エミュレーターで「<b>LOAD\"*\",8</b>」と入力してください。\nC64画面がフリーズし、ドライブLEDインジケーターがまだ表示されない場合は、「File > Open」でFrodo.fprを開き、F12キーを押してエミュレーターを再起動し、もう一度試してください。\n\n② ソフトウェアが読み込まれたら、「<b>RUN</b>」と入力してください。C64ゲームが始まったら、「Tools > Patch and Save Snapshot」をクリックし、スナップショットを「snap.fss」として保存してください。\nまた、後で使うためにコピーを保存しておくこともできます。\n\nAttempts left: <b>{0}</b>",
Expand All @@ -115,7 +116,7 @@
"save_project": "プロジェクトを保存(&S)",
"save_project_as": "プロジェクトを別名で保存...(&A)",
"close_project": "プロジェクトを閉じる(&C)",
"close_all": "すべてのプロジェクトを閉じる(&L)",
"close_all": "すべてのプロジェクトを閉じる(&N)",
"import_game_file": "{0}を取り込む...(&G)",
"game_scan": "ゲーム情報を読み出す(&S)",
"export": "書き出す...(&E)",
Expand Down
3 changes: 2 additions & 1 deletion FriishProduce/Strings/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@
"e_014": "이 콘솔에 필요한 바이오스 파일을 찾을 수 없습니다.\n응용 프로그램 환경 설정에서 이 파일을 설정하세요.",
"e_015": "저장된 데이터 TPL을 만드는 데 실패했습니다.",
"e_016": "제공된 WAD에서 버추얼 콘솔 설명서를 찾을 수 없습니다.",
"e_017": "\"{0}\" 유효한 프로젝트 파일이 아닙니다."
"e_017": "\"{0}\" 유효한 프로젝트 파일이 아닙니다.",
"e_018": "Unable to save {0}."
},

"html": {
Expand Down
2 changes: 1 addition & 1 deletion FriishProduce/Subforms/ContentOptions/Options_Flash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private void valueChanged(object sender, EventArgs e)
{
if (!File.Exists(DLSPath) || string.IsNullOrWhiteSpace(DLSPath))
{
ImportDLS.Title = midi.Text;
ImportDLS.Title = midi.Text.Replace("&", "");

if (ImportDLS.ShowDialog() == System.Windows.Forms.DialogResult.OK)
DLSPath = ImportDLS.FileName;
Expand Down
9 changes: 4 additions & 5 deletions FriishProduce/_classes/Creators/WiiVC/N64.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ protected override void Load()

base.Load();

if (WAD.Region == Region.Korea) EmuType = 3;
if (MainContent.GetNodeIndex("romc") != -1)
EmuType = 3;
else EmuType = WAD.UpperTitleID.Substring(0, 3).ToUpper() switch
{
"NAB"
Expand Down Expand Up @@ -66,14 +67,12 @@ protected override void ReplaceROM()
{
// -----------------------
// Check filesize
// Maximum ROM limit allowed: 32 MB unless allocated in main.dol (maximum possible: ~56 MB)
// Maximum ROM limit allowed: 64 MB for ROMC, otherwise 32 MB unless allocated in main.dol (maximum possible: ~56 MB)
// -----------------------
ROM.MaxSize = Allocate ? 56623104 : 33554432;
ROM.MaxSize = EmuType == 3 ? 67108864 : Allocate ? 56623104 : 33554432;
ROM.CheckSize();
var data = (ROM as ROM_N64).ToBigEndian();

if (MainContent.GetNodeIndex("romc") != -1) EmuType = 3;

// -----------------------
// Actually replace original ROM
// -----------------------
Expand Down
Loading

0 comments on commit 8374f61

Please sign in to comment.