Minor misc changes (#1360)

* core: cleanup include headers
* dx11: remove unimplemented function
* core: annotate destructors with override
* aica: use range-based for loop
* bm: use const reference/structured bindings with blkmap
This commit is contained in:
scribam 2024-01-02 14:38:16 +01:00 committed by GitHub
parent 9c964ac955
commit 6aa59c54a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 41 additions and 57 deletions

View File

@ -95,8 +95,8 @@ static int AicaUpdate(int tag, int cycles, int jitter, void *arg)
void timeStep()
{
for (std::size_t i = 0; i < std::size(timers); i++)
timers[i].StepTimer(1);
for (auto& timer : timers)
timer.StepTimer(1);
SCIPD->SAMPLE_DONE = 1;
MCIPD->SAMPLE_DONE = 1;

View File

@ -17,7 +17,6 @@
#include "serialize.h"
#include "hw/arm7/arm_mem.h"
#include "hw/arm7/arm7.h"
#include "dsp.h"
#include "sgc_if.h"
#include "aica.h"
@ -529,10 +528,10 @@ void serialize(Serializer& ser)
dsp::state.serialize(ser);
for (int i = 0 ; i < 3 ; i++)
for (const auto& timer : timers)
{
ser << timers[i].c_step;
ser << timers[i].m_step;
ser << timer.c_step;
ser << timer.m_step;
}
if (!ser.rollback())

View File

@ -5,7 +5,6 @@
#pragma once
#include "types.h"
#include "hw/hwreg.h"
#include <array>
u32 sb_ReadMem(u32 addr);
void sb_WriteMem(u32 addr, u32 data);

View File

@ -9,8 +9,8 @@
#include "cfg/option.h"
#include "rend/gui.h"
#include <zlib.h>
#include <time.h>
#include <errno.h>
#include <cerrno>
#include <ctime>
const char* maple_sega_controller_name = "Dreamcast Controller";
const char* maple_sega_vmu_name = "Visual Memory";

View File

@ -272,7 +272,7 @@ struct maple_naomi_jamma : maple_base, SerialPort
u8 eeprom[128];
maple_naomi_jamma();
~maple_naomi_jamma();
~maple_naomi_jamma() override;
MapleDeviceType get_device_type() override
{

View File

@ -24,7 +24,7 @@
#include "rend/gui.h"
#include <deque>
#include <memory>
#include <errno.h>
#include <cerrno>
namespace card_reader {
@ -383,7 +383,7 @@ public:
SCIFSerialPort::Instance().setPipe(this);
}
~InitialDCardReader() {
~InitialDCardReader() override {
SCIFSerialPort::Instance().setPipe(nullptr);
}
};
@ -396,7 +396,7 @@ public:
getMieDevice()->setPipe(this);
}
~DerbyBRCardReader() {
~DerbyBRCardReader() override {
getMieDevice()->setPipe(nullptr);
}
};
@ -408,7 +408,7 @@ public:
getMieDevice()->setPipe(this);
}
~DerbyLRCardReader() {
~DerbyLRCardReader() override {
getMieDevice()->setPipe(nullptr);
}
};
@ -478,7 +478,7 @@ public:
ClubKartCardReader() {
SCIFSerialPort::Instance().setPipe(this);
}
~ClubKartCardReader() {
~ClubKartCardReader() override {
SCIFSerialPort::Instance().setPipe(nullptr);
}
@ -685,7 +685,7 @@ public:
SCIFSerialPort::Instance().setPipe(this);
}
~BarcodeReader() {
~BarcodeReader() override {
SCIFSerialPort::Instance().setPipe(nullptr);
}

View File

@ -17,7 +17,6 @@
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/
#include "hopper.h"
#include "network/ggpo.h"
#include "input/gamepad.h"
#include "hw/maple/maple_cfg.h"
#include "hw/sh4/sh4_sched.h"

View File

@ -33,7 +33,6 @@ static Multiboard *multiboard;
#include "naomi_roms.h"
#include "cfg/option.h"
#include "hw/sh4/sh4_sched.h"
#include <thread>
#include <chrono>
constexpr int SyncCycles = 500000;

View File

@ -26,7 +26,6 @@
#include "decrypt.h"
#include "naomi_roms.h"
#include "hw/flashrom/nvmem.h"
#include "hw/holly/holly_intc.h"
#include "m1cartridge.h"
#include "m4cartridge.h"
#include "awcartridge.h"

View File

@ -24,7 +24,7 @@ class NetDimm : public GDCartridge
{
public:
NetDimm(u32 size);
~NetDimm();
~NetDimm() override;
void Init(LoadProgress *progress = nullptr, std::vector<u8> *digest = nullptr) override;

View File

@ -26,7 +26,6 @@
#include "hw/maple/maple_cfg.h"
#include "input/gamepad.h"
#include "hw/sh4/sh4_sched.h"
#include "hw/mem/addrspace.h"
#include "hw/holly/holly_intc.h"
#include "hw/holly/sb.h"
#include "oslib/storage.h"
@ -35,7 +34,8 @@
#include "card_reader.h"
#include "naomi_roms.h"
#include "stdclass.h"
#include <errno.h>
#include <cerrno>
#include <deque>
#ifdef DEBUG_SERIAL
#define SERIAL_LOG(...) DEBUG_LOG(NAOMI, __VA_ARGS__)
@ -506,7 +506,7 @@ public:
schedId = sh4_sched_register(0, schedCallback, this);
}
~Touchscreen()
~Touchscreen() override
{
sh4_sched_unregister(schedId);
}

View File

@ -23,8 +23,6 @@
#include "hw/naomi/m4cartridge.h"
#include "hw/flashrom/at93cxx.h"
#include "serialize.h"
#include <deque>
#include <array>
#include <memory>
#include <libchdr/chd.h>
@ -52,7 +50,7 @@ public:
SerialPort(SystemSpCart *cart, int index) : cart(cart), index(index) {
}
~SerialPort() {
~SerialPort() override {
if (pipe != nullptr)
delete pipe;
}
@ -147,7 +145,7 @@ class SystemSpCart : public M4Cartridge
{
public:
SystemSpCart(u32 size);
~SystemSpCart();
~SystemSpCart() override;
void Init(LoadProgress *progress = nullptr, std::vector<u8> *digest = nullptr) override;
void setMediaName(const char *mediaName, const char *parentName) {

View File

@ -44,7 +44,7 @@ public:
SCIFSerialPort::Instance().setPipe(this);
}
~TouchscreenPipe()
~TouchscreenPipe() override
{
SCIFSerialPort::Instance().setPipe(nullptr);
sh4_sched_unregister(schedId);

View File

@ -360,9 +360,8 @@ void bm_WriteBlockMap(const std::string& file)
if (f)
{
INFO_LOG(DYNAREC, "Writing block map !");
for (auto& it : blkmap)
for (const auto& [_, block] : blkmap)
{
RuntimeBlockInfoPtr& block = it.second;
fprintf(f, "block: %d:%08X:%p:%d:%d:%d\n", block->BlockType, block->addr, block->code, block->host_code_size, block->guest_cycles, block->guest_opcodes);
for(size_t j = 0; j < block->oplist.size(); j++)
fprintf(f,"\top: %zd:%d:%s\n", j, block->oplist[j].guest_offs, block->oplist[j].dissasm().c_str());
@ -374,9 +373,8 @@ void bm_WriteBlockMap(const std::string& file)
void sh4_jitsym(FILE* out)
{
for (const auto& it : blkmap)
for (const auto& [_, block] : blkmap)
{
const RuntimeBlockInfoPtr& block = it.second;
fprintf(out, "%p %d %08X\n", block->code, block->host_code_size, block->addr);
}
}
@ -548,9 +546,8 @@ void print_blocks()
INFO_LOG(DYNAREC, "Writing blocks to %p", f);
}
for (auto it : blkmap)
for (const auto& [_, blk] : blkmap)
{
RuntimeBlockInfoPtr blk = it.second;
if (f)
{
fprintf(f,"block: %p\n",blk.get());

View File

@ -2,6 +2,7 @@
#include "types.h"
#include "decoder.h"
#include "shil.h"
#include "stdclass.h"
#include <memory>

View File

@ -1,5 +1,4 @@
#pragma once
#include "shil.h"
#include "../sh4_if.h"
#define mkbet(c,s,v) ((c<<3)|(s<<1)|v)

View File

@ -8,8 +8,6 @@
#include "hw/sh4/sh4_mem.h"
#include "hw/sh4/modules/mmu.h"
#include <ctime>
#include "blockmanager.h"
#include "ngen.h"
#include "decoder.h"

View File

@ -18,7 +18,6 @@
*/
#include "mmu.h"
#include "hw/sh4/sh4_if.h"
#include "hw/sh4/sh4_interrupts.h"
#include "hw/sh4/sh4_core.h"
#include "types.h"

View File

@ -1,7 +1,6 @@
#pragma once
#include "types.h"
#include "hw/sh4/sh4_mmr.h"
#include "cfg/option.h"
#include "hw/sh4/dyna/ngen.h"
//Translation Types

View File

@ -1,6 +1,5 @@
#pragma once
#include "types.h"
#include "sh4_if.h"
#undef sh4op
#define sh4op(str) void DYNACALL str (u32 op)

View File

@ -9,7 +9,6 @@
#include "sh4_mmr.h"
#include "hw/pvr/elan.h"
#include "hw/pvr/pvr_mem.h"
#include "cfg/option.h"
#include "hw/mem/addrspace.h"
#include "hw/sh4/modules/mmu.h"

View File

@ -2,6 +2,8 @@
#include "types.h"
#include "sh4_interpreter.h"
#include <cstring>
extern OpCallFP* OpPtr[0x10000];
typedef void OpDissasmFP(char* out,const char* const FormatString,u32 pc,u16 opcode);

View File

@ -21,7 +21,7 @@ struct CHDDisc : Disc
void tryOpen(const char* file);
~CHDDisc()
~CHDDisc() override
{
delete[] hunk_mem;

View File

@ -17,7 +17,6 @@
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "build.h"
#include <string>
namespace lua

View File

@ -32,7 +32,7 @@ struct ModemEmu : public SerialPort::Pipe
schedId = sh4_sched_register(0, schedCallback);
}
~ModemEmu() {
~ModemEmu() override {
sh4_sched_unregister(schedId);
stop_pico();
SCIFSerialPort::Instance().setPipe(nullptr);

View File

@ -17,8 +17,8 @@
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "types.h"
#include <future>
#include <string>
struct MapleInputState;

View File

@ -1,6 +1,5 @@
#pragma once
#include "types.h"
#include <vector>
#if defined(__SWITCH__)
#include <malloc.h>
#endif

View File

@ -32,7 +32,7 @@ public:
bool initialize(const std::string& saveDirectory) override;
void scrape(GameBoxart& item) override;
void scrape(std::vector<GameBoxart>& items) override;
~TheGamesDb();
~TheGamesDb() override;
private:
void fetchPlatforms();

View File

@ -30,7 +30,7 @@ public:
ImGui_ImplDX11_Init(device, deviceContext);
}
~DX11Driver() {
~DX11Driver() override {
ImGui_ImplDX11_Shutdown();
}

View File

@ -127,7 +127,6 @@ protected:
bool dithering = false;
private:
void readDCFramebuffer();
void prepareRttRenderTarget(u32 texAddress);
void setBaseScissor();
void drawStrips();

View File

@ -20,7 +20,6 @@
#include "rend/osd.h"
#include <glm/glm.hpp>
#include <glm/gtx/transform.hpp>
#include <tuple>
void D3DOverlay::drawQuad(const RECT& rect, D3DCOLOR color)
{

View File

@ -29,7 +29,7 @@ public:
ImGui_ImplDX9_Init(device);
}
~DX9Driver() {
~DX9Driver() override {
ImGui_ImplDX9_Shutdown();
}

View File

@ -4,7 +4,9 @@
#include "rend/osd.h"
#include "naomi2.h"
#include "rend/transform_matrix.h"
#ifdef LIBRETRO
#include "postprocess.h"
#endif
#include <memory>

View File

@ -4,6 +4,7 @@
#ifndef LIBRETRO
#include "rend/gui.h"
#else
#include "rend/gles/postprocess.h"
#include "vmu_xhair.h"
#endif
#include "rend/osd.h"
@ -12,7 +13,6 @@
#include "wsi/gl_context.h"
#include "emulator.h"
#include "naomi2.h"
#include "rend/gles/postprocess.h"
#ifdef TEST_AUTOMATION
#include "cfg/cfg.h"

View File

@ -20,7 +20,9 @@
#include "imgui.h"
#include "gui_util.h"
#include "cheats.h"
#ifdef __ANDROID__
#include "oslib/storage.h"
#endif
static bool addingCheat;

View File

@ -19,7 +19,6 @@
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/
#include "buffer.h"
#include "utils.h"
#include "vulkan_context.h"
BufferData::BufferData(vk::DeviceSize size, vk::BufferUsageFlags usage, vk::MemoryPropertyFlags propertyFlags)

View File

@ -52,7 +52,7 @@ class Deleter : public Deletable
{
public:
Deleter(T *p) : p(p) {}
~Deleter() {
~Deleter() override {
delete p;
}
private:

View File

@ -19,7 +19,6 @@
#pragma once
#include "build.h"
#ifndef TARGET_UWP
#include "input/gamepad_device.h"
#include "input/keyboard_device.h"
#include "input/mouse.h"
#include <windows.h>

View File

@ -27,7 +27,7 @@
class EGLGraphicsContext : public GLGraphicsContext
{
public:
~EGLGraphicsContext() { term(); }
~EGLGraphicsContext() override { term(); }
bool init();
void term() override;

View File

@ -25,7 +25,7 @@
class XGLGraphicsContext : public GLGraphicsContext
{
public:
~XGLGraphicsContext() { term(); XFree(framebufferConfigs); }
~XGLGraphicsContext() override { term(); XFree(framebufferConfigs); }
bool init();
void term() override;