Skip to content

Commit

Permalink
Custom palette support for passwords
Browse files Browse the repository at this point in the history
Reverse engineered the brightness changing function to get rid of LUTs.
  • Loading branch information
blzla committed Nov 23, 2021
1 parent e7cb1d3 commit ea4e728
Show file tree
Hide file tree
Showing 5 changed files with 245 additions and 98 deletions.
2 changes: 1 addition & 1 deletion AboutBox.resx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ In memory of Near. Without their work on bsnes this tool would not have been pos
SGB Settings Editor is released under GPL 3.0 license.
The commented source code is available at: https://github.com/blzla/SGB-Settings-Editor

Version 1.2
Version 1.3
By blizzz, 2021</value>
</data>
</root>
141 changes: 78 additions & 63 deletions MainWindow.Designer.cs

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

18 changes: 15 additions & 3 deletions MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,8 @@ private void startupBorderToolStripMenuItem_Click(object sender, EventArgs e)

private void palettePasswordsToolStripMenuItem_Click(object sender, EventArgs e)
{
setPalette(activePaletteSlot);
ConvertPalettePassword();
tabControlMain.SelectedIndex = 3;
paletteEditorToolStripMenuItem.Checked = false;
presetsToolStripMenuItem.Checked = false;
Expand Down Expand Up @@ -912,10 +914,10 @@ private void drawBorder()
// #####################################################################################
// Palette Passwords

// Convert password input to colors
private void textBoxPasswords_TextChanged(object sender, EventArgs e)
// Convert password input and update color panels
private void ConvertPalettePassword()
{
var (valid, paletteDependant, palette) = Passwords.ConvertPassword(textBoxPasswords.Text);
var (valid, paletteDependant, palette) = Passwords.ConvertPassword(textBoxPasswords.Text, checkBoxPasswordCustom.Checked);

int dashes = textBoxPasswords.Text.Count(c => c == '-');
if (textBoxPasswords.Text.Length - dashes > 12)
Expand Down Expand Up @@ -943,6 +945,16 @@ private void textBoxPasswords_TextChanged(object sender, EventArgs e)
}
}

private void textBoxPasswords_TextChanged(object sender, EventArgs e)
{
ConvertPalettePassword();
}

private void checkBoxPasswordCustom_CheckedChanged(object sender, EventArgs e)
{
ConvertPalettePassword();
}

// Copy colors from password panels to active palette
private void buttonPasswordSetActivePalette_Click(object sender, EventArgs e)
{
Expand Down
Loading

0 comments on commit ea4e728

Please sign in to comment.