Skip to content

Commit

Permalink
Minor misc changes (#1360)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
scribam authored Jan 2, 2024
1 parent 9c964ac commit 6aa59c5
Show file tree
Hide file tree
Showing 40 changed files with 41 additions and 57 deletions.
4 changes: 2 additions & 2 deletions core/hw/aica/aica.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 3 additions & 4 deletions core/hw/aica/aica_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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())
Expand Down
1 change: 0 additions & 1 deletion core/hw/holly/sb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions core/hw/maple/maple_devs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion core/hw/maple/maple_devs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
12 changes: 6 additions & 6 deletions core/hw/naomi/card_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "rend/gui.h"
#include <deque>
#include <memory>
#include <errno.h>
#include <cerrno>

namespace card_reader {

Expand Down Expand Up @@ -383,7 +383,7 @@ class InitialDCardReader final : public SanwaCRP1231BR
SCIFSerialPort::Instance().setPipe(this);
}

~InitialDCardReader() {
~InitialDCardReader() override {
SCIFSerialPort::Instance().setPipe(nullptr);
}
};
Expand All @@ -396,7 +396,7 @@ class DerbyBRCardReader final : public SanwaCRP1231BR
getMieDevice()->setPipe(this);
}

~DerbyBRCardReader() {
~DerbyBRCardReader() override {
getMieDevice()->setPipe(nullptr);
}
};
Expand All @@ -408,7 +408,7 @@ class DerbyLRCardReader final : public SanwaCRP1231LR
getMieDevice()->setPipe(this);
}

~DerbyLRCardReader() {
~DerbyLRCardReader() override {
getMieDevice()->setPipe(nullptr);
}
};
Expand Down Expand Up @@ -478,7 +478,7 @@ class ClubKartCardReader : public CardReaderWriter, SerialPort::Pipe
ClubKartCardReader() {
SCIFSerialPort::Instance().setPipe(this);
}
~ClubKartCardReader() {
~ClubKartCardReader() override {
SCIFSerialPort::Instance().setPipe(nullptr);
}

Expand Down Expand Up @@ -685,7 +685,7 @@ class BarcodeReader final : public SerialPort::Pipe
SCIFSerialPort::Instance().setPipe(this);
}

~BarcodeReader() {
~BarcodeReader() override {
SCIFSerialPort::Instance().setPipe(nullptr);
}

Expand Down
1 change: 0 additions & 1 deletion core/hw/naomi/hopper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion core/hw/naomi/multiboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion core/hw/naomi/naomi_cart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion core/hw/naomi/netdimm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions core/hw/naomi/systemsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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__)
Expand Down Expand Up @@ -506,7 +506,7 @@ class Touchscreen : public SerialPort::Pipe
schedId = sh4_sched_register(0, schedCallback, this);
}

~Touchscreen()
~Touchscreen() override
{
sh4_sched_unregister(schedId);
}
Expand Down
6 changes: 2 additions & 4 deletions core/hw/naomi/systemsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -52,7 +50,7 @@ class SerialPort : public ::SerialPort
SerialPort(SystemSpCart *cart, int index) : cart(cart), index(index) {
}

~SerialPort() {
~SerialPort() override {
if (pipe != nullptr)
delete pipe;
}
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion core/hw/naomi/touchscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class TouchscreenPipe final : public SerialPort::Pipe
SCIFSerialPort::Instance().setPipe(this);
}

~TouchscreenPipe()
~TouchscreenPipe() override
{
SCIFSerialPort::Instance().setPipe(nullptr);
sh4_sched_unregister(schedId);
Expand Down
9 changes: 3 additions & 6 deletions core/hw/sh4/dyna/blockmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -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());
Expand Down
1 change: 1 addition & 0 deletions core/hw/sh4/dyna/blockmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "types.h"
#include "decoder.h"
#include "shil.h"
#include "stdclass.h"

#include <memory>
Expand Down
1 change: 0 additions & 1 deletion core/hw/sh4/dyna/decoder.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#pragma once
#include "shil.h"
#include "../sh4_if.h"

#define mkbet(c,s,v) ((c<<3)|(s<<1)|v)
Expand Down
2 changes: 0 additions & 2 deletions core/hw/sh4/dyna/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion core/hw/sh4/modules/fastmmu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 0 additions & 1 deletion core/hw/sh4/modules/mmu.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion core/hw/sh4/sh4_interpreter.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once
#include "types.h"
#include "sh4_if.h"

#undef sh4op
#define sh4op(str) void DYNACALL str (u32 op)
Expand Down
1 change: 0 additions & 1 deletion core/hw/sh4/sh4_mem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 2 additions & 0 deletions core/hw/sh4/sh4_opcode_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion core/imgread/chd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct CHDDisc : Disc

void tryOpen(const char* file);

~CHDDisc()
~CHDDisc() override
{
delete[] hunk_mem;

Expand Down
1 change: 0 additions & 1 deletion core/lua/lua.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "build.h"
#include <string>

namespace lua
Expand Down
2 changes: 1 addition & 1 deletion core/network/alienfnt_modem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion core/network/ggpo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion core/oslib/oslib.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once
#include "types.h"
#include <vector>
#if defined(__SWITCH__)
#include <malloc.h>
#endif
Expand Down
2 changes: 1 addition & 1 deletion core/rend/boxart/gamesdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TheGamesDb : public Scraper
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();
Expand Down
2 changes: 1 addition & 1 deletion core/rend/dx11/dx11_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DX11Driver final : public ImGuiDriver
ImGui_ImplDX11_Init(device, deviceContext);
}

~DX11Driver() {
~DX11Driver() override {
ImGui_ImplDX11_Shutdown();
}

Expand Down
1 change: 0 additions & 1 deletion core/rend/dx11/dx11_renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ struct DX11Renderer : public Renderer
bool dithering = false;

private:
void readDCFramebuffer();
void prepareRttRenderTarget(u32 texAddress);
void setBaseScissor();
void drawStrips();
Expand Down
1 change: 0 additions & 1 deletion core/rend/dx9/d3d_overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion core/rend/dx9/dx9_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class DX9Driver final : public ImGuiDriver
ImGui_ImplDX9_Init(device);
}

~DX9Driver() {
~DX9Driver() override {
ImGui_ImplDX9_Shutdown();
}

Expand Down
Loading

0 comments on commit 6aa59c5

Please sign in to comment.