Skip to content

Commit

Permalink
Merge pull request audetto#207 from audetto/linux_dword2
Browse files Browse the repository at this point in the history
Replace DWORD -> uint32_t.
  • Loading branch information
audetto authored Dec 22, 2024
2 parents 6b89df0 + 94ff669 commit cebe2ba
Show file tree
Hide file tree
Showing 26 changed files with 63 additions and 63 deletions.
16 changes: 8 additions & 8 deletions source/frontends/common2/commonframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace common2
ResetHardware();
}

BYTE* CommonFrame::GetResource(WORD id, LPCSTR lpType, DWORD expectedSize)
BYTE* CommonFrame::GetResource(WORD id, LPCSTR lpType, uint32_t expectedSize)
{
myResource.clear();

Expand Down Expand Up @@ -138,15 +138,15 @@ namespace common2
void CommonFrame::ExecuteInRunningMode(const int64_t microseconds)
{
SetFullSpeed(CanDoFullSpeed());
const DWORD cyclesToExecute = mySpeed.getCyclesTillNext(microseconds); // this checks g_bFullSpeed
const uint32_t cyclesToExecute = mySpeed.getCyclesTillNext(microseconds); // this checks g_bFullSpeed
Execute(cyclesToExecute);
}

void CommonFrame::ExecuteInDebugMode(const int64_t microseconds)
{
// In AppleWin this is called without a timer for just one iteration
// because we run a "frame" at a time, we need a bit of ingenuity
const DWORD cyclesToExecute = mySpeed.getCyclesAtFixedSpeed(microseconds);
const uint32_t cyclesToExecute = mySpeed.getCyclesAtFixedSpeed(microseconds);
const int64_t target = g_nCumulativeCycles + cyclesToExecute;

while (g_nAppMode == MODE_STEPPING && g_nCumulativeCycles < target)
Expand All @@ -155,21 +155,21 @@ namespace common2
}
}

void CommonFrame::Execute(const DWORD cyclesToExecute)
void CommonFrame::Execute(const uint32_t cyclesToExecute)
{
const bool bVideoUpdate = myAllowVideoUpdate && !g_bFullSpeed;
const UINT dwClksPerFrame = NTSC_GetCyclesPerFrame();

// do it in the same batches as AppleWin (1 ms)
const DWORD fExecutionPeriodClks = g_fCurrentCLK6502 * (1.0 / 1000.0); // 1 ms
const uint32_t fExecutionPeriodClks = g_fCurrentCLK6502 * (1.0 / 1000.0); // 1 ms

DWORD totalCyclesExecuted = 0;
uint32_t totalCyclesExecuted = 0;
// check at the end because we want to always execute at least 1 cycle even for "0"
do
{
_ASSERT(cyclesToExecute >= totalCyclesExecuted);
const DWORD thisCyclesToExecute = std::min(fExecutionPeriodClks, cyclesToExecute - totalCyclesExecuted);
const DWORD executedCycles = CpuExecute(thisCyclesToExecute, bVideoUpdate);
const uint32_t thisCyclesToExecute = std::min(fExecutionPeriodClks, cyclesToExecute - totalCyclesExecuted);
const uint32_t executedCycles = CpuExecute(thisCyclesToExecute, bVideoUpdate);
totalCyclesExecuted += executedCycles;

GetCardMgr().Update(executedCycles);
Expand Down
4 changes: 2 additions & 2 deletions source/frontends/common2/commonframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace common2

void Begin() override;

BYTE* GetResource(WORD id, LPCSTR lpType, DWORD expectedSize) override;
BYTE* GetResource(WORD id, LPCSTR lpType, uint32_t expectedSize) override;

virtual void ResetSpeed();

Expand Down Expand Up @@ -49,7 +49,7 @@ namespace common2

void ExecuteInRunningMode(const int64_t microseconds);
void ExecuteInDebugMode(const int64_t microseconds);
void Execute(const DWORD uCycles);
void Execute(const uint32_t uCycles);

Speed mySpeed;

Expand Down
6 changes: 3 additions & 3 deletions source/frontends/common2/ptreeregistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ namespace common2
return getValue<std::string>(section, key);
}

DWORD PTreeRegistry::getDWord(const std::string & section, const std::string & key) const
uint32_t PTreeRegistry::getDWord(const std::string & section, const std::string & key) const
{
return getValue<DWORD>(section, key);
return getValue<uint32_t>(section, key);
}

bool PTreeRegistry::getBool(const std::string & section, const std::string & key) const
Expand All @@ -47,7 +47,7 @@ namespace common2
putValue(section, key, value);
}

void PTreeRegistry::putDWord(const std::string & section, const std::string & key, const DWORD value)
void PTreeRegistry::putDWord(const std::string & section, const std::string & key, const uint32_t value)
{
putValue(section, key, value);
}
Expand Down
4 changes: 2 additions & 2 deletions source/frontends/common2/ptreeregistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ namespace common2
typedef boost::property_tree::basic_ptree<std::string, std::string, KeyQtEncodedLess> ini_t;

std::string getString(const std::string & section, const std::string & key) const override;
DWORD getDWord(const std::string & section, const std::string & key) const override;
uint32_t getDWord(const std::string & section, const std::string & key) const override;
bool getBool(const std::string & section, const std::string & key) const override;

void putString(const std::string & section, const std::string & key, const std::string & value) override;
void putDWord(const std::string & section, const std::string & key, const DWORD value) override;
void putDWord(const std::string & section, const std::string & key, const uint32_t value) override;

template<typename T>
T getValue(const std::string & section, const std::string & key) const;
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/common2/speed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace

uint32_t checkAndReturn(const int64_t cycles)
{
// AppleWin uses DWORD, so we check the value is sound
// AppleWin uses uint32_t, so we check the value is sound
const int64_t cyclesToExecute = std::max<int64_t>(0, cycles);
_ASSERT(cyclesToExecute <= std::numeric_limits<uint32_t>::max());

Expand Down
6 changes: 3 additions & 3 deletions source/frontends/common2/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ namespace common2
const std::string path = section + "\\geometry";
const auto loadValue = [&path](const char * name, int & dest)
{
DWORD value;
uint32_t value;
if (RegLoadValue(path.c_str(), name, TRUE, &value))
{
// DWORD and int have the same size
// uint32_t and int have the same size
// but if they did not, this would be necessary
typedef std::make_signed<DWORD>::type signed_t;
typedef std::make_signed<uint32_t>::type signed_t;
dest = static_cast<signed_t>(value);
}
};
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/libretro/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace ra2
const VideoType_e prevVideoType = video.GetVideoType();
const VideoStyle_e prevVideoStyle = video.GetVideoStyle();

DWORD dwTmp = prevVideoType;
uint32_t dwTmp = prevVideoType;
RegLoadValue(REG_CONFIG, REGVALUE_VIDEO_MODE, TRUE, &dwTmp);
const VideoType_e newVideoType = static_cast<VideoType_e>(dwTmp);

Expand Down
22 changes: 11 additions & 11 deletions source/frontends/libretro/retroregistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace
std::string description;
std::string section;
std::string key;
std::vector<std::pair<std::string, DWORD> > values;
std::vector<std::pair<std::string, uint32_t> > values;
};

const std::vector<Variable> ourVariables =
Expand Down Expand Up @@ -128,8 +128,8 @@ namespace
REG_RA2,
REGVALUE_AUDIO_SOURCE,
{
{REGVALUE_AUDIO_SPEAKER, static_cast<DWORD>(ra2::AudioSource::SPEAKER)},
{REGVALUE_AUDIO_MOCKINGBOARD, static_cast<DWORD>(ra2::AudioSource::MOCKINGBOARD)},
{REGVALUE_AUDIO_SPEAKER, static_cast<uint32_t>(ra2::AudioSource::SPEAKER)},
{REGVALUE_AUDIO_MOCKINGBOARD, static_cast<uint32_t>(ra2::AudioSource::MOCKINGBOARD)},
}
},
{
Expand All @@ -138,8 +138,8 @@ namespace
REG_RA2,
REGVALUE_KEYBOARD_TYPE,
{
{"ASCII", static_cast<DWORD>(ra2::KeyboardType::ASCII)},
{"Original", static_cast<DWORD>(ra2::KeyboardType::Original)},
{"ASCII", static_cast<uint32_t>(ra2::KeyboardType::ASCII)},
{"Original", static_cast<uint32_t>(ra2::KeyboardType::Original)},
}
},
{
Expand All @@ -148,8 +148,8 @@ namespace
REG_RA2,
REGVALUE_PLAYLIST_START,
{
{"First", static_cast<DWORD>(ra2::PlaylistStartDisk::First)},
{"Previous", static_cast<DWORD>(ra2::PlaylistStartDisk::Previous)},
{"First", static_cast<uint32_t>(ra2::PlaylistStartDisk::First)},
{"Previous", static_cast<uint32_t>(ra2::PlaylistStartDisk::Previous)},
}
},
};
Expand Down Expand Up @@ -232,22 +232,22 @@ namespace ra2

AudioSource GetAudioSource()
{
DWORD value = 1;
uint32_t value = 1;
RegLoadValue(REG_RA2, REGVALUE_AUDIO_SOURCE, TRUE, &value);
const AudioSource source = value <= DWORD(AudioSource::UNKNOWN) ? AudioSource(value) : AudioSource::UNKNOWN;
const AudioSource source = value <= uint32_t(AudioSource::UNKNOWN) ? AudioSource(value) : AudioSource::UNKNOWN;
return source;
}

KeyboardType GetKeyboardEmulationType()
{
DWORD value = static_cast<DWORD>(KeyboardType::ASCII);
uint32_t value = static_cast<uint32_t>(KeyboardType::ASCII);
RegLoadValue(REG_RA2, REGVALUE_KEYBOARD_TYPE, TRUE, &value);
return static_cast<KeyboardType>(value);
}

PlaylistStartDisk GetPlaylistStartDisk()
{
DWORD value = static_cast<DWORD>(PlaylistStartDisk::First);
uint32_t value = static_cast<uint32_t>(PlaylistStartDisk::First);
RegLoadValue(REG_RA2, REGVALUE_PLAYLIST_START, TRUE, &value);
return static_cast<PlaylistStartDisk>(value);
}
Expand Down
4 changes: 2 additions & 2 deletions source/frontends/qt/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ std::string Configuration::getString(const std::string & section, const std::str
return res;
}

DWORD Configuration::getDWord(const std::string & section, const std::string & key) const
uint32_t Configuration::getDWord(const std::string & section, const std::string & key) const
{
const QVariant value = getVariant(section, key);
const uint res = value.toUInt();
Expand All @@ -48,7 +48,7 @@ void Configuration::putString(const std::string & section, const std::string & k
mySettings.setValue(getKey(section, key), QVariant::fromValue(s));
}

void Configuration::putDWord(const std::string & section, const std::string & key, const DWORD value)
void Configuration::putDWord(const std::string & section, const std::string & key, const uint32_t value)
{
mySettings.setValue(getKey(section, key), QVariant::fromValue(value));
}
Expand Down
4 changes: 2 additions & 2 deletions source/frontends/qt/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ class Configuration : public Registry
{
public:
std::string getString(const std::string & section, const std::string & key) const override;
DWORD getDWord(const std::string & section, const std::string & key) const override;
uint32_t getDWord(const std::string & section, const std::string & key) const override;
bool getBool(const std::string & section, const std::string & key) const override;

void putString(const std::string & section, const std::string & key, const std::string & value) override;
void putDWord(const std::string & section, const std::string & key, const DWORD value) override;
void putDWord(const std::string & section, const std::string & key, const uint32_t value) override;

std::map<std::string, std::map<std::string, std::string>> getAllValues() const override;

Expand Down
4 changes: 2 additions & 2 deletions source/frontends/qt/qapple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void QApple::on_timer()

const qint64 maximumToRun = 10 * myOptions.msGap * audioAdjustedSpeed * 1.0e-3; // just to avoid crazy times (e.g. debugging)
const qint64 toRun = std::min(targetCycles - currentCycles, maximumToRun);
const DWORD uCyclesToExecute = toRun;
const uint32_t uCyclesToExecute = toRun;

const bool bVideoUpdate = true;

Expand All @@ -208,7 +208,7 @@ void QApple::on_timer()
int count = 0;
do
{
const DWORD uActualCyclesExecuted = CpuExecute(uCyclesToExecute, bVideoUpdate);
const uint32_t uActualCyclesExecuted = CpuExecute(uCyclesToExecute, bVideoUpdate);
g_dwCyclesThisFrame += uActualCyclesExecuted;
cardManager.Update(uActualCyclesExecuted);
SpkrUpdate(uActualCyclesExecuted);
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/qt/qdirectsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ namespace

if (info.running)
{
const DWORD bytesInBuffer = GetBytesInBuffer();
const uint32_t bytesInBuffer = GetBytesInBuffer();
const auto & format = myAudioOutput->format();
info.buffer = format.durationForBytes(bytesInBuffer) / 1000;
info.size = format.durationForBytes(myBufferSize) / 1000;
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/qt/qtframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void QtFrame::GetBitmap(LPCSTR lpBitmapName, LONG cb, LPVOID lpvBits)
}
}

BYTE* QtFrame::GetResource(WORD id, LPCSTR lpType, DWORD expectedSize)
BYTE* QtFrame::GetResource(WORD id, LPCSTR lpType, uint32_t expectedSize)
{
Q_UNUSED(lpType);
myResource.clear();
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/qt/qtframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class QtFrame : public LinuxFrame

int FrameMessageBox(LPCSTR lpText, LPCSTR lpCaption, UINT uType) override;
void GetBitmap(LPCSTR lpBitmapName, LONG cb, LPVOID lpvBits) override;
BYTE* GetResource(WORD id, LPCSTR lpType, DWORD expectedSize) override;
BYTE* GetResource(WORD id, LPCSTR lpType, uint32_t expectedSize) override;
std::string Video_GetScreenShotFolder() const override;

void SetForceRepaint(const bool force);
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/sdl/imgui/sdldebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ namespace sa2
}
}

void ImGuiDebugger::setCurrentAddress(const DWORD nAddress)
void ImGuiDebugger::setCurrentAddress(const uint32_t nAddress)
{
g_nDisasmCurAddress = nAddress;
DisasmCalcTopBotAddress();
Expand Down
4 changes: 2 additions & 2 deletions source/frontends/sdl/imgui/sdldebugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace sa2
bool myScrollConsole = true;

int64_t myBaseDebuggerCycles;
std::unordered_map<DWORD, int64_t> myAddressCycles;
std::unordered_map<uint32_t, int64_t> myAddressCycles;

CycleTabItems myCycleTabItems;
InputTextHistory myInputTextHistory;
Expand All @@ -42,7 +42,7 @@ namespace sa2

void processDebuggerKeys();

void setCurrentAddress(const DWORD nAddress);
void setCurrentAddress(const uint32_t nAddress);
};

}
4 changes: 2 additions & 2 deletions source/frontends/sdl/imgui/sdlsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ namespace
}
}

void setSpeedMultiplier(sa2::SDLFrame* frame, const DWORD speedMultiplier)
void setSpeedMultiplier(sa2::SDLFrame* frame, const uint32_t speedMultiplier)
{
g_dwSpeed = speedMultiplier;
SetCurrentCLK6502();
Expand Down Expand Up @@ -354,7 +354,7 @@ namespace sa2
if (ImGui::Checkbox("Enhanced speed", &enhancedSpeed))
{
cardManager.GetDisk2CardMgr().SetEnhanceDisk(enhancedSpeed);
REGSAVE(TEXT(REGVALUE_ENHANCE_DISK_SPEED), (DWORD)enhancedSpeed);
REGSAVE(TEXT(REGVALUE_ENHANCE_DISK_SPEED), (uint32_t)enhancedSpeed);
}

ImGui::Separator();
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/sdl/imgui/settingshelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ namespace sa2
REGSAVE(TEXT(REGVALUE_UTHERNET_ACTIVE), enabled);
}

void changeBreakpoint(const DWORD nAddress, const bool enableAndSet)
void changeBreakpoint(const uint32_t nAddress, const bool enableAndSet)
{
// see _BWZ_RemoveOne
for (Breakpoint_t & bp : g_aBreakpoints)
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/sdl/imgui/settingshelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ namespace sa2

void saveTFEEnabled(const int enabled);

void changeBreakpoint(const DWORD nAddress, const bool enableAndSet);
void changeBreakpoint(const uint32_t nAddress, const bool enableAndSet);

ImVec4 colorrefToImVec4(const COLORREF cr);
COLORREF imVec4ToColorref(const ImVec4 & color);
Expand Down
4 changes: 2 additions & 2 deletions source/frontends/sdl/sdirectsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ namespace

void DirectSoundGenerator::printInfo()
{
const DWORD bytesInBuffer = GetBytesInBuffer();
const uint32_t bytesInBuffer = GetBytesInBuffer();
std::cerr << "Channels: " << (int)myAudioSpec.channels;
std::cerr << ", buffer: " << std::setw(6) << bytesInBuffer;
const double time = double(bytesInBuffer) / myBytesPerSecond * 1000;
Expand All @@ -184,7 +184,7 @@ namespace

if (info.running && myBytesPerSecond > 0)
{
const DWORD bytesInBuffer = GetBytesInBuffer();
const uint32_t bytesInBuffer = GetBytesInBuffer();
const float coeff = 1.0 / myBytesPerSecond;
info.buffer = bytesInBuffer * coeff;
info.size = myBufferSize * coeff;
Expand Down
2 changes: 1 addition & 1 deletion source/linux/benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ void VideoBenchmark(std::function<void()> redraw, std::function<void()> refresh)

do {
// this is a simplified version of AppleWin.cpp:ContinueExecution()
const DWORD executedcycles = CpuExecute(cyclesPerMs, true);
const uint32_t executedcycles = CpuExecute(cyclesPerMs, true);
cyclesThisFrame += executedcycles;
// every ms disk and joystick are updated
GetCardMgr().GetDisk2CardMgr().Update(executedcycles);
Expand Down
2 changes: 1 addition & 1 deletion source/linux/duplicates/Joystick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void JoySetTrim(short nValue, bool bAxisX)
{
}

void JoySetJoyType(UINT num, DWORD type)
void JoySetJoyType(UINT num, uint32_t type)
{
}

Expand Down
2 changes: 1 addition & 1 deletion source/linux/duplicates/PropertySheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ void CPropertySheet::Init(void)
{
}

DWORD CPropertySheet::GetVolumeMax(void)
uint32_t CPropertySheet::GetVolumeMax(void)
{
return 99;
}
Expand Down
Loading

0 comments on commit cebe2ba

Please sign in to comment.