Skip to content

Commit

Permalink
Various bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ferris committed May 18, 2013
1 parent b511985 commit 8d2eb8a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
3 changes: 2 additions & 1 deletion Chip8/Chip8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ void Chip8::Reset()
for (int i = 0; i < 16 * 5; i++) ram[i] = charMem[i];
for (int i = 0; i < 16; i++) inputs[i] = false;
gpu.Clear();
gpu.Update();
apu.SetBeeping(false);
running = false;
waitingForKeypress = false;
Expand Down Expand Up @@ -338,8 +339,8 @@ void Chip8::Update()
}
catch (const Exception& e)
{
MessageWindow::Error(e.GetMsg());
running = false;
throw e;
}

gpu.Update();
Expand Down
4 changes: 2 additions & 2 deletions Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ bool Config::tryGetValue(const List<String>& input, const String& name, int& val
for (int i = 0; i < input.Count(); i++)
{
auto parts = input[i].Split(':');
if (parts.Count() == 2 && parts[0] == name)
if (parts.Count() == 2 && parts[0].Trim() == name)
{
if (parts[1].TryParseInt(value)) return true;
if (parts[1].Trim().TryParseInt(value)) return true;
}
}
return false;
Expand Down
17 changes: 9 additions & 8 deletions Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@ int Main(const List<String>& arguments)
Config config(Directory::GetApplicationDirectory() + "\\config.cfg");

auto window = Window::Create("Vip8");
Key keys[] =
{
Key::Number1, Key::Number2, Key::Number3, Key::Number4,
Key::Q, Key::W, Key::E, Key::R,
Key::A, Key::S, Key::D, Key::F,
Key::Z, Key::X, Key::C, Key::V
};
Key keys[] = { Key::X, Key::Number1, Key::Number2, Key::Number3, Key::Q, Key::W, Key::E, Key::A, Key::S, Key::D, Key::Z, Key::C, Key::Number4, Key::R, Key::F, Key::V };
window->KeyDown += [&] (Key key)
{
if (key == Key::Escape)
Expand Down Expand Up @@ -199,7 +193,14 @@ int Main(const List<String>& arguments)

while (running)
{
chip8.Update();
try
{
chip8.Update();
}
catch (const Exception& e)
{
MessageWindow::Error(window, "Emulation error: " + e.GetMsg());
}
window->Update();
}

Expand Down

0 comments on commit 8d2eb8a

Please sign in to comment.