mirror of
https://github.com/libretro/Mu.git
synced 2026-09-22 22:56:12 +00:00
C89 fixes part 3
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#ifndef SANDBOX_H
|
||||
#define SANDBOX_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
@@ -15,3 +16,5 @@ uint32_t sandboxCommand(uint32_t test, void* data);
|
||||
void sandboxOnOpcodeRun();
|
||||
bool sandboxRunning();
|
||||
void sandboxReturn();//should only be called called by 68k code
|
||||
|
||||
#endif
|
||||
|
||||
@@ -81,12 +81,11 @@ 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);
|
||||
uint8_t prescaler = (pwmc1 >> 8 & 0x7F) + 1;
|
||||
uint8_t clockDivider = 2 << (pwmc1 & 0x03);
|
||||
uint8_t repeat = 1 << (pwmc1 >> 2 & 0x03);
|
||||
int32_t audioNow = now + clockOffset;
|
||||
int32_t audioSampleDuration = usingClk32 ? audioGetFramePercentIncrementFromClk32s(period * prescaler * clockDivider) : audioGetFramePercentIncrementFromSysclks(period * prescaler * clockDivider);
|
||||
int32_t audioSampleDuration = (pwmc1 & 0x8000)/*usingClk32*/ ? audioGetFramePercentIncrementFromClk32s(period * prescaler * clockDivider) : audioGetFramePercentIncrementFromSysclks(period * prescaler * clockDivider);
|
||||
double dutyCycle = dMin((double)sample / period, 1.00);
|
||||
|
||||
for(uint8_t index = 0; index < repeat; index++){
|
||||
|
||||
@@ -7,7 +7,7 @@ static void timer1(uint8_t reason, double sysclks){
|
||||
uint16_t timer1Compare = registerArrayRead16(TCMP1);
|
||||
double timer1OldCount = timerCycleCounter[0];
|
||||
double timer1Prescaler = (registerArrayRead16(TPRER1) & 0x00FF) + 1;
|
||||
bool timer1Enabled = timer1Control & 0x0001;
|
||||
bool timer1Enabled = timer1Control & 0x0001;//no need for a bool cast, already using the lowest bit
|
||||
|
||||
if(timer1Enabled){
|
||||
switch((timer1Control & 0x000E) >> 1){
|
||||
@@ -74,7 +74,7 @@ static void timer2(uint8_t reason, double sysclks){
|
||||
uint16_t timer2Compare = registerArrayRead16(TCMP2);
|
||||
double timer2OldCount = timerCycleCounter[1];
|
||||
double timer2Prescaler = (registerArrayRead16(TPRER2) & 0x00FF) + 1;
|
||||
bool timer2Enabled = timer2Control & 0x0001;
|
||||
bool timer2Enabled = timer2Control & 0x0001;//no need for a bool cast, already using the lowest bit
|
||||
|
||||
if(timer2Enabled){
|
||||
switch((timer2Control & 0x000E) >> 1){
|
||||
|
||||
@@ -321,8 +321,8 @@ void sed1376SetRegister(uint8_t address, uint8_t value){
|
||||
void sed1376Render(){
|
||||
if(palmMisc.lcdOn && pllIsOn() && !sed1376PowerSaveEnabled() && !(sed1376Registers[DISP_MODE] & 0x80)){
|
||||
//only render if LCD on, PLL on, power save off, and force blank off, SED1376 clock is provided by the CPU, if its off so is the SED
|
||||
bool color = sed1376Registers[PANEL_TYPE] & 0x40;
|
||||
bool pictureInPictureEnabled = sed1376Registers[SPECIAL_EFFECT] & 0x10;
|
||||
bool color = !!(sed1376Registers[PANEL_TYPE] & 0x40);
|
||||
bool pictureInPictureEnabled = !!(sed1376Registers[SPECIAL_EFFECT] & 0x10);
|
||||
uint8_t bitDepth = 1 << (sed1376Registers[DISP_MODE] & 0x07);
|
||||
uint16_t rotation = 90 * (sed1376Registers[SPECIAL_EFFECT] & 0x03);
|
||||
|
||||
@@ -331,8 +331,11 @@ void sed1376Render(){
|
||||
selectRenderer(color, bitDepth);
|
||||
|
||||
if(renderPixel){
|
||||
MULTITHREAD_DOUBLE_LOOP for(uint16_t pixelY = 0; pixelY < 160; pixelY++)
|
||||
for(uint16_t pixelX = 0; pixelX < 160; pixelX++)
|
||||
uint16_t pixelX;
|
||||
uint16_t pixelY;
|
||||
|
||||
MULTITHREAD_DOUBLE_LOOP for(pixelY = 0; pixelY < 160; pixelY++)
|
||||
for(pixelX = 0; pixelX < 160; pixelX++)
|
||||
palmFramebuffer[pixelY * 160 + pixelX] = renderPixel(pixelX, pixelY);
|
||||
|
||||
//debugLog("Screen start address:0x%08X, buffer width:%d, swivel view:%d degrees\n", screenStartAddress, lineSize, rotation);
|
||||
@@ -392,7 +395,7 @@ void sed1376Render(){
|
||||
}
|
||||
}
|
||||
else{
|
||||
debugLog("Invalid screen format, color:%s, BPP:%d, rotation:%d\n", boolString(color), bitDepth, rotation);
|
||||
debugLog("Invalid screen format, color:%s, BPP:%d, rotation:%d\n", color ? "true" : "false", bitDepth, rotation);
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -116,8 +116,8 @@ static void selectRenderer(bool color, uint8_t bpp){
|
||||
|
||||
//updaters
|
||||
static void updateLcdStatus(){
|
||||
bool backlightEnabled = sed1376Registers[GPIO_CONT_0] & sed1376Registers[GPIO_CONF_0] & 0x10;
|
||||
bool backlightEnabled = !!(sed1376Registers[GPIO_CONT_0] & sed1376Registers[GPIO_CONF_0] & 0x10);
|
||||
|
||||
palmMisc.lcdOn = sed1376Registers[GPIO_CONT_0] & sed1376Registers[GPIO_CONF_0] & 0x20;
|
||||
palmMisc.lcdOn = !!(sed1376Registers[GPIO_CONT_0] & sed1376Registers[GPIO_CONF_0] & 0x20);
|
||||
palmMisc.backlightLevel = backlightEnabled ? (1 + backlightAmplifierState()) : 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user