More minor changes

This commit is contained in:
Andrea Orru 2020-05-11 00:13:20 +09:00
parent 02f02312f1
commit 4edcb23436
3 changed files with 13 additions and 11 deletions

View file

@ -37,9 +37,7 @@ const char* get_config_path(char* buf, int buflen)
{
/* Bail on the complex stuff if we don't need it */
if (!USE_CONFIG_DIR)
{
return CONFIG_FALLBACK;
}
/* First, get the home directory */
char homepath[CONFIG_PATH_MAX];
@ -102,7 +100,9 @@ void load_settings()
BTN_B[p] = atoi(ini.GetValue(section, "B", "-1"));
BTN_SELECT[p] = atoi(ini.GetValue(section, "SELECT", "-1"));
BTN_START[p] = atoi(ini.GetValue(section, "START", "-1"));
} else {
}
else
{
KEY_UP[p] = (SDL_Scancode)atoi(ini.GetValue(section, "UP", "82"));
KEY_DOWN[p] = (SDL_Scancode)atoi(ini.GetValue(section, "DOWN", "81"));
KEY_LEFT[p] = (SDL_Scancode)atoi(ini.GetValue(section, "LEFT", "80"));

View file

@ -122,7 +122,8 @@ void PLA() { T; T; A = pop(); upd_nz(A); }
void PHA() { T; push(A); }
/* Flow control (branches, jumps) */
template<Flag f, bool v> void br() {
template<Flag f, bool v> void br()
{
s8 j = rd(imm());
if (P[f] == v) {
if (cross(PC, j)) T;
@ -238,10 +239,8 @@ void exec()
case 0xF9: return SBC<aby>() ; case 0xFD: return SBC<abx>() ;
case 0xFE: return INC<_abx>() ;
default:
{
std::cout << "Invalid OPcode! PC: " << PC << " OPcode: 0x" << std::hex << (int)rd(PC-1) << "\n";
return NOP();
}
std::cout << "Invalid Opcode! PC: " << PC << " Opcode: 0x" << std::hex << (int)(rd(PC - 1)) << "\n";
return NOP();
}
}

View file

@ -70,14 +70,16 @@ void Menu::update(u8 const* keys)
{
int oldCursor = cursor;
if (keys[SDL_SCANCODE_DOWN] and cursor < entries.size() - 1) {
if (keys[SDL_SCANCODE_DOWN] and cursor < entries.size() - 1)
{
cursor++;
if (cursor == bottom) {
bottom += 1;
top += 1;
}
}
else if (keys[SDL_SCANCODE_UP] and cursor > 0) {
else if (keys[SDL_SCANCODE_UP] and cursor > 0)
{
cursor--;
if (cursor < top) {
top -= 1;
@ -93,7 +95,8 @@ void Menu::update(u8 const* keys)
void Menu::render()
{
for (int i = top; i < entries.size() && i < bottom; ++i) {
for (int i = top; i < entries.size() && i < bottom; ++i)
{
int y = (i - top) * FONT_SZ;
entries[i]->render(TEXT_CENTER, y);
}