pointer address ipv dereferenced value

This commit is contained in:
wgroeneveld 2018-08-07 09:35:53 +02:00
parent eac770bf6c
commit a9c8f4e5ef
2 changed files with 5 additions and 6 deletions

View File

@ -8,7 +8,7 @@
#include "allocator.h"
int x = 0;
void onvblank() {
void GBAEngine::onVBlank() {
REG_IME = 0;
unsigned short tempInterruptState = REG_IF;
@ -82,8 +82,8 @@ void GBAEngine::queueSound(const s8 *data, int totalSamples, int sampleRate, Sou
REG_SNDDSCNT |= control.ControlFlags; // output to both sides, reset fifo
REG_SNDSTAT = SSTAT_ENABLE; // enable all sound
*(control.DMASourceAddress) = (u32) data;
*(control.DMADestinationAddress) = *(control.FiFoBuffer);
*(control.DMASourceAddress) = (u32) data; // WARNING - these are pointers to the address!
*(control.DMADestinationAddress) = (u32) control.FiFoBuffer;
*(control.DMAControl) = DMA_DST_FIXED | DMA_REPEAT | DMA_32 | DMA_SYNC_TO_TIMER | DMA_ENABLE;
u16 ticksPerSample = CLOCK / sampleRate; // divide the clock (ticks/second) by the sample rate (samples/second)
@ -101,7 +101,7 @@ GBAEngine::GBAEngine() {
// setup interrupt control flags for vblank IRQing
REG_DISPSTAT |= DISPLAY_INTERRUPT_VBLANK_ENABLE;
REG_IE |= INTERRUPT_VBLANK;
*IRQ_CALLBACK = (u32) &onvblank;
*IRQ_CALLBACK = (u32) &GBAEngine::onVBlank;
//REG_IME = 1;
REG_SNDDSCNT = 0;

View File

@ -33,8 +33,6 @@ struct SoundControl {
u16 ControlFlags;
};
void onvblank();
class GBAEngine {
private:
// WHY raw pointers? the engine does the transition and cleanup work itself
@ -56,6 +54,7 @@ private:
void cleanupPreviousScene();
void queueSound(const s8* data, int totalSamples, int sampleRate, SoundControl control);
static void onVBlank();
public:
GBAEngine();