clang-format

This commit is contained in:
wheremyfoodat 2023-06-28 01:48:34 +03:00
parent 71582eff6d
commit 29806ff8e5
3 changed files with 257 additions and 266 deletions

View file

@ -1,20 +1,19 @@
#pragma once
#include <filesystem>
#include <fstream>
#include <SDL.h>
#include <glad/gl.h>
#include <filesystem>
#include <fstream>
#include "PICA/gpu.hpp"
#include "cpu.hpp"
#include "crypto/aes_engine.hpp"
#include "io_file.hpp"
#include "memory.hpp"
#include "opengl.hpp"
#include "PICA/gpu.hpp"
enum class ROMType {
None, ELF, NCSD
};
enum class ROMType { None, ELF, NCSD };
class Emulator {
CPU cpu;

View file

@ -87,13 +87,8 @@ public:
void pressKey(u32 mask) { newButtons |= mask; }
void releaseKey(u32 mask) { newButtons &= ~mask; }
s16 getCirclepadX() {
return circlePadX;
}
s16 getCirclepadY() {
return circlePadY;
}
s16 getCirclepadX() { return circlePadX; }
s16 getCirclepadY() { return circlePadY; }
void setCirclepadX(s16 x) {
circlePadX = x;

View file

@ -16,10 +16,7 @@ void Emulator::reset() {
}
void Emulator::step() {}
void Emulator::render() {
}
void Emulator::render() {}
void Emulator::run() {
while (running) {
@ -42,6 +39,7 @@ void Emulator::run() {
printf("Bye :(\n");
running = false;
return;
case SDL_KEYDOWN:
switch (event.key.keysym.sym) {
case SDLK_l: srv.pressKey(Keys::A); break;
@ -81,6 +79,7 @@ void Emulator::run() {
case SDLK_BACKSPACE: srv.pressKey(Keys::Select); break;
}
break;
case SDL_KEYUP:
switch (event.key.keysym.sym) {
case SDLK_l: srv.releaseKey(Keys::A); break;
@ -126,8 +125,7 @@ void Emulator::run() {
u16 y_converted = static_cast<u16>(y) - 240;
srv.setTouchScreenPress(x_converted, y_converted);
}
else {
} else {
srv.releaseTouchScreen();
}
}
@ -211,9 +209,7 @@ void Emulator::run() {
}
}
void Emulator::runFrame() {
cpu.runFrame();
}
void Emulator::runFrame() { cpu.runFrame(); }
bool Emulator::loadROM(const std::filesystem::path& path) {
// Get path for saving files (AppData on Windows, /home/user/.local/share/ApplcationName on Linux, etc)
@ -277,8 +273,9 @@ bool Emulator::loadELF(std::ifstream& file) {
loadedELF.seekg(0);
std::optional<u32> entrypoint = memory.loadELF(loadedELF);
if (!entrypoint.has_value())
if (!entrypoint.has_value()) {
return false;
}
cpu.setReg(15, entrypoint.value()); // Set initial PC
if (entrypoint.value() & 1) {