Skip to content

Commit

Permalink
Converted over to MemoryWatcher as our dolphin memory input mechanism
Browse files Browse the repository at this point in the history
 - No more spin loops!
 - Out of the box support from Dolphin. No need to apply a patch
 - Maybe more latency. Let's keep an eye on that.
  • Loading branch information
AltF4 committed Jan 11, 2016
1 parent 6864441 commit 5eb963f
Show file tree
Hide file tree
Showing 11 changed files with 647 additions and 569 deletions.
12 changes: 5 additions & 7 deletions GameState.cpp
Expand Up @@ -13,6 +13,11 @@ GameState *GameState::Instance()
return m_instance;
}

GameState::GameState()
{
m_memory = new GameMemory();
}

double GameState::getStageEdgePosition()
{
double edge_position = 100;
Expand Down Expand Up @@ -81,13 +86,6 @@ bool GameState::isDamageState(ACTION action)
return false;
}


GameState::GameState()
{

}


uint GameState::firstHitboxFrame(CHARACTER character, ACTION action)
{
switch(character)
Expand Down
43 changes: 34 additions & 9 deletions Goals/NavigateMenu.cpp
Expand Up @@ -6,6 +6,7 @@ NavigateMenu::NavigateMenu()
//There is no lower strategy for menuing
m_strategy = NULL;
m_emptiedInput = false;
m_characterSelected = false;
}

NavigateMenu::~NavigateMenu()
Expand Down Expand Up @@ -35,6 +36,18 @@ void NavigateMenu::Strategize()
return;
}

//If fox is selected, and we're out of the fox area, then we're good. Do nothing
if((m_state->m_memory->player_two_character == CHARACTER::FOX) &&
((m_state->m_memory->player_two_pointer_x < -27) ||
(m_state->m_memory->player_two_pointer_x > -20) ||
(m_state->m_memory->player_two_pointer_y < 8) ||
(m_state->m_memory->player_two_pointer_y > 15)))
{
m_characterSelected = true;
m_controller->emptyInput();
return;
}

//If we're not fox, and the cursor isn't in Y position, move into position
if((m_state->m_memory->player_two_character != CHARACTER::FOX) &&
((m_state->m_memory->player_two_pointer_y < 8) ||
Expand Down Expand Up @@ -69,15 +82,27 @@ void NavigateMenu::Strategize()
return;
}

//If we're not fox, and the cursor _IS_ in position, select fox
if((m_state->m_memory->player_two_character != CHARACTER::FOX) &&
((m_state->m_memory->player_two_pointer_x > -27) &&
(m_state->m_memory->player_two_pointer_x < -20) &&
(m_state->m_memory->player_two_pointer_y > 8) &&
(m_state->m_memory->player_two_pointer_y < 15)))
//If we're fox, and the cursor _IS_ in position, select fox
if((m_state->m_memory->player_two_character == CHARACTER::FOX) &&
((m_state->m_memory->player_two_pointer_x > -27) &&
(m_state->m_memory->player_two_pointer_x < -20) &&
(m_state->m_memory->player_two_pointer_y > 8) &&
(m_state->m_memory->player_two_pointer_y < 15)))
{
m_controller->tiltAnalog(Controller::BUTTON_MAIN, .5, .5);
m_controller->pressButton(Controller::BUTTON_A);
return;
//If fox isn't selected yet, select it
if(!m_characterSelected)
{
m_characterSelected = true;
m_controller->tiltAnalog(Controller::BUTTON_MAIN, .5, .5);
m_controller->pressButton(Controller::BUTTON_A);
return;
}
//If he is selected, move away to make sure
else
{
m_controller->tiltAnalog(Controller::BUTTON_MAIN, 1, .5);
return;
}

}
}
1 change: 1 addition & 0 deletions Goals/NavigateMenu.h
Expand Up @@ -16,6 +16,7 @@ class NavigateMenu : public Goal
private:
Controller *m_controller;
bool m_emptiedInput;
bool m_characterSelected;
};

#endif
44 changes: 44 additions & 0 deletions Locations.txt
@@ -0,0 +1,44 @@
004530E0
00453F70
0045310E
00453F9E
004530C0
00453F50
00453090
00453F20
00453094
00453F24
00453130 70
00453130 20CC
00453130 8F4
00453130 19EC
00453130 19BC
00453130 23a0
00453130 2174
00453130 19C8
00453130 140
00453130 E0
00453130 E4
00453130 EC
00453130 F0
00453130 14C
00453FC0 70
00453FC0 20CC
00453FC0 8F4
00453FC0 19EC
00453FC0 19BC
00453FC0 23a0
00453FC0 2174
00453FC0 19C8
00453FC0 140
00453FC0 E0
00453FC0 E4
00453FC0 EC
00453FC0 F0
00453FC0 14C
003F0E0A
003F0E2E
00479d30
0111826C
01118270
00479D60
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -2,7 +2,7 @@ CC=g++
CFLAGS=-g -c -Wall -std=gnu++11
LDFLAGS=-g -Wall -std=gnu++11

SOURCES=cpu.cpp Controller.cpp GameState.cpp
SOURCES=cpu.cpp Controller.cpp GameState.cpp MemoryWatcher.cpp
GOALS=Goals/*.cpp
STRATS=Strategies/*.cpp
TACTICS=Tactics/*.cpp
Expand Down

0 comments on commit 5eb963f

Please sign in to comment.