mirror of
https://github.com/libretro/Mu.git
synced 2026-09-22 14:45:57 +00:00
Convert to C89 pass 1
This commit is contained in:
@@ -227,7 +227,7 @@ else ifeq ($(platform), psp1)
|
||||
TARGET := $(TARGET_NAME)_libretro_$(platform).$(EXT)
|
||||
CC = psp-gcc$(EXE_EXT)
|
||||
AR = psp-ar$(EXE_EXT)
|
||||
CFLAGS += -std=c99 -DPSP -G0
|
||||
CFLAGS += -DPSP -G0
|
||||
STATIC_LINKING=1
|
||||
STATIC_LINKING_LINK=1
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ else
|
||||
COREDEFINES += -DEMU_NO_SAFETY
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring msvc2003,$(platform)))
|
||||
ifneq (,$(findstring msvc200,$(platform)))
|
||||
INCFLAGS += -I$(LIBRETRO_COMM_DIR)/include/compat/msvc
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#pragma once
|
||||
#ifndef CURSORS_H
|
||||
#define CURSORS_H
|
||||
|
||||
extern const unsigned char cursor16x16[];
|
||||
extern const unsigned char cursor32x32[];
|
||||
|
||||
#endif
|
||||
|
||||
@@ -44,21 +44,27 @@ static void renderMouseCursor(int16_t screenX, int16_t screenY){
|
||||
static const uint16_t* joystickCursor32 = cursor32x32;
|
||||
|
||||
if(screenHires){
|
||||
int8_t x;
|
||||
int8_t y;
|
||||
|
||||
//align cursor to side of image
|
||||
screenX -= 6;
|
||||
|
||||
for(int8_t y = 0; y < 32; y++)
|
||||
for(int8_t x = 6; x < 26; x++)
|
||||
for(y = 0; y < 32; y++)
|
||||
for(x = 6; x < 26; x++)
|
||||
if(screenX + x >= 0 && screenY + y >= 0 && screenX + x < 320 && screenY + y < 440)
|
||||
if(joystickCursor32[y * 32 + x] != 0x0000)
|
||||
screenData[(screenY + y) * 320 + screenX + x] = joystickCursor32[y * 32 + x];
|
||||
}
|
||||
else{
|
||||
int8_t x;
|
||||
int8_t y;
|
||||
|
||||
//align cursor to side of image
|
||||
screenX -= 3;
|
||||
|
||||
for(int8_t y = 0; y < 16; y++)
|
||||
for(int8_t x = 3; x < 13; x++)
|
||||
for(y = 0; y < 16; y++)
|
||||
for(x = 3; x < 13; x++)
|
||||
if(screenX + x >= 0 && screenY + y >= 0 && screenX + x < 160 && screenY + y < 220)
|
||||
if(joystickCursor16[y * 16 + x] != 0x0000)
|
||||
screenData[(screenY + y) * 160 + screenX + x] = joystickCursor16[y * 16 + x];
|
||||
|
||||
@@ -78,7 +78,6 @@ CONFIG(debug, debug|release){
|
||||
DEFINES += EMU_NO_SAFETY
|
||||
}
|
||||
|
||||
QMAKE_CFLAGS += -std=c99
|
||||
CONFIG += c++11
|
||||
|
||||
INCLUDEPATH += $$PWD/qt-common/include
|
||||
|
||||
@@ -20,7 +20,7 @@ static double ads7846RangeMap(double oldMin, double oldMax, double value, double
|
||||
}
|
||||
|
||||
static bool ads7846GetAdcBit(){
|
||||
bool bit = ads7846OutputValue & 0x8000;
|
||||
bool bit = !!(ads7846OutputValue & 0x8000);
|
||||
ads7846OutputValue <<= 1;
|
||||
return bit;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef ADS7846_H
|
||||
#define ADS7846_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
@@ -13,3 +14,5 @@ void ads7846LoadState(uint8_t* data);
|
||||
void ads7846SetChipSelect(bool value);
|
||||
bool ads7846ExchangeBit(bool bitIn);
|
||||
bool ads7846Busy();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "../portability.h"
|
||||
#include "../emulator.h"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
extern double inductorCurrentCharge;
|
||||
extern double inductorChargeAtLastSample;
|
||||
|
||||
@@ -295,7 +295,7 @@ bool flx68000IsSupervisor(){
|
||||
#if defined(EMU_OPTIMIZE_FOR_ARM)
|
||||
return CycloneGetSr(&cycloneCpu) & 0x2000;
|
||||
#else
|
||||
return m68k_get_reg(NULL, M68K_REG_SR) & 0x2000;
|
||||
return !!(m68k_get_reg(NULL, M68K_REG_SR) & 0x2000);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -51,11 +51,11 @@ bool pllIsOn(){
|
||||
}
|
||||
|
||||
bool backlightAmplifierState(){
|
||||
return getPortKValue() & 0x02;
|
||||
return !!(getPortKValue() & 0x02);
|
||||
}
|
||||
|
||||
bool registersAreXXFFMapped(){
|
||||
return registerArrayRead8(SCR) & 0x04;
|
||||
return !!(registerArrayRead8(SCR) & 0x04);
|
||||
}
|
||||
|
||||
bool sed1376ClockConnected(){
|
||||
@@ -281,7 +281,7 @@ static void checkPortDInterrupts(){
|
||||
*/
|
||||
|
||||
//IRQ1, polarity set in ICR
|
||||
if(portDIrqPins & ~portDDir & 0x10 && (bool)(portDInputValues & 0x10) == (bool)(interruptControlRegister & 0x8000)){
|
||||
if(portDIrqPins & ~portDDir & 0x10 && !!(portDInputValues & 0x10) == !!(interruptControlRegister & 0x8000)){
|
||||
if(!(interruptControlRegister & 0x0800) || !(interruptEdgeTriggered & INT_IRQ1))
|
||||
setIprIsrBit(INT_IRQ1);
|
||||
interruptEdgeTriggered |= INT_IRQ1;
|
||||
@@ -293,7 +293,7 @@ static void checkPortDInterrupts(){
|
||||
}
|
||||
|
||||
//IRQ2, polarity set in ICR
|
||||
if(portDIrqPins & ~portDDir & 0x20 && (bool)(portDInputValues & 0x20) == (bool)(interruptControlRegister & 0x4000)){
|
||||
if(portDIrqPins & ~portDDir & 0x20 && !!(portDInputValues & 0x20) == !!(interruptControlRegister & 0x4000)){
|
||||
if(!(interruptControlRegister & 0x0400) || !(interruptEdgeTriggered & INT_IRQ2))
|
||||
setIprIsrBit(INT_IRQ2);
|
||||
interruptEdgeTriggered |= INT_IRQ2;
|
||||
@@ -305,7 +305,7 @@ static void checkPortDInterrupts(){
|
||||
}
|
||||
|
||||
//IRQ3, polarity set in ICR
|
||||
if(portDIrqPins & ~portDDir & 0x40 && (bool)(portDInputValues & 0x40) == (bool)(interruptControlRegister & 0x2000)){
|
||||
if(portDIrqPins & ~portDDir & 0x40 && !!(portDInputValues & 0x40) == !!(interruptControlRegister & 0x2000)){
|
||||
if(!(interruptControlRegister & 0x0200) || !(interruptEdgeTriggered & INT_IRQ3))
|
||||
setIprIsrBit(INT_IRQ3);
|
||||
interruptEdgeTriggered |= INT_IRQ3;
|
||||
@@ -317,7 +317,7 @@ static void checkPortDInterrupts(){
|
||||
}
|
||||
|
||||
//IRQ6, polarity set in ICR
|
||||
if(portDIrqPins & ~portDDir & 0x80 && (bool)(portDInputValues & 0x80) == (bool)(interruptControlRegister & 0x1000)){
|
||||
if(portDIrqPins & ~portDDir & 0x80 && !!(portDInputValues & 0x80) == !!(interruptControlRegister & 0x1000)){
|
||||
if(!(interruptControlRegister & 0x0100) || !(interruptEdgeTriggered & INT_IRQ6))
|
||||
setIprIsrBit(INT_IRQ6);
|
||||
interruptEdgeTriggered |= INT_IRQ6;
|
||||
|
||||
@@ -81,7 +81,7 @@ int32_t pwm1FifoRunSample(int32_t now, int32_t clockOffset){
|
||||
uint8_t sample = pwm1Fifo[pwm1ReadPosition];
|
||||
uint16_t period = registerArrayRead8(PWMP1) + 2;
|
||||
uint16_t pwmc1 = registerArrayRead16(PWMC1);
|
||||
bool usingClk32 = pwmc1 & 0x8000;
|
||||
bool usingClk32 = !!(pwmc1 & 0x8000);
|
||||
uint8_t prescaler = (pwmc1 >> 8 & 0x7F) + 1;
|
||||
uint8_t clockDivider = 2 << (pwmc1 & 0x03);
|
||||
uint8_t repeat = 1 << (pwmc1 >> 2 & 0x03);
|
||||
@@ -619,7 +619,7 @@ static void samplePwm1(bool forClk32, double sysclks){
|
||||
int32_t audioClocks;
|
||||
|
||||
//check if enabled and validate clock mode, CLK32 is used if PLL is disabled as the inductor still needs to settle
|
||||
if(forClk32 != (bool)(pwmc1 & 0x8000) && !(forClk32 && palmSysclksPerClk32 < 1.0))
|
||||
if(forClk32 != !!(pwmc1 & 0x8000) && !(forClk32 && palmSysclksPerClk32 < 1.0))
|
||||
return;
|
||||
|
||||
//these calculations are fairly heavy, only do them after we know the clock mode is valid
|
||||
@@ -667,7 +667,7 @@ static uint16_t getPwmc1(){
|
||||
|
||||
//updaters
|
||||
static void updatePowerButtonLedStatus(){
|
||||
palmMisc.powerButtonLed = (bool)(getPortBValue() & 0x40) != palmMisc.batteryCharging;
|
||||
palmMisc.powerButtonLed = !!(getPortBValue() & 0x40) != palmMisc.batteryCharging;
|
||||
}
|
||||
|
||||
static void updateVibratorStatus(){
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef PORTABILITY_H
|
||||
#define PORTABILITY_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
@@ -25,10 +26,6 @@ static inline void swap16BufferIfLittle(uint8_t* buffer, uint64_t count){
|
||||
#define MULTITHREAD_DOUBLE_LOOP
|
||||
#endif
|
||||
|
||||
static inline const char* boolString(bool boo){
|
||||
return boo ? "true" : "false";
|
||||
}
|
||||
|
||||
static inline uint64_t uMin(uint64_t x, uint64_t y){
|
||||
return x < y ? x : y;
|
||||
}
|
||||
@@ -157,3 +154,5 @@ static inline bool readStateValueBool(uint8_t* where){
|
||||
static inline void writeStateValueBool(uint8_t* where, bool value){
|
||||
where[0] = value;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user