Skip to content

Commit d987998

Browse files
committed
cafe: logging cleanup
1 parent 922e1c5 commit d987998

3 files changed

Lines changed: 9 additions & 29 deletions

File tree

platform/cafe/include/modules/joystick/kpad/Joystick.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace love
2121

2222
~Joystick();
2323

24-
virtual void update();
24+
virtual void update() override;
2525

2626
virtual bool open(int64_t deviceId) override;
2727

platform/cafe/source/driver/audio/DigitalSound.cpp

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,14 @@ namespace love
3232
};
3333
// clang-format on
3434

35-
OSEvent s_Event;
3635
volatile bool s_Init = false;
3736

38-
static void audioCallback()
39-
{
40-
if (!s_Init)
41-
return;
42-
43-
OSSignalEvent(&s_Event);
44-
}
45-
4637
// # region Device
4738

4839
bool Device::open()
4940
{
5041
AXInitWithParams(&AX_INIT_PARAMS);
5142
s_Init = AXIsInit();
52-
53-
// OSInitEvent(&s_Event, false, OS_EVENT_MODE_AUTO);
54-
// AXRegisterAppFrameCallback(audioCallback);
55-
5643
return s_Init;
5744
}
5845

@@ -122,7 +109,7 @@ namespace love
122109

123110
void update()
124111
{
125-
if (this->currentBuffer && !this->currentBuffer->isFinished())
112+
if (!this->currentBuffer)
126113
return;
127114

128115
if (this->buffers.empty())
@@ -148,10 +135,10 @@ namespace love
148135

149136
void addBuffer(Buffer* buffer)
150137
{
151-
this->buffers.push(buffer);
152-
153138
buffer->setSampleRate(this->samplerate);
154139
buffer->setVolume(this->volume);
140+
141+
this->buffers.push(buffer);
155142
}
156143

157144
bool isPaused() const
@@ -192,9 +179,6 @@ namespace love
192179

193180
void Device::update()
194181
{
195-
if (!s_Init)
196-
return;
197-
198182
for (auto& channel : s_Channels)
199183
channel.update();
200184

@@ -206,7 +190,6 @@ namespace love
206190
if (!s_Init)
207191
return;
208192

209-
// AXDeregisterAppFrameCallback(audioCallback);
210193
s_Init = false;
211194
AXQuit();
212195
}
@@ -263,6 +246,8 @@ namespace love
263246
for (int channel = 0; channel < channels; channel++)
264247
{
265248
this->buffer.voices[channel] = AXAcquireVoice(0x1F, nullptr, nullptr);
249+
if (!this->buffer.voices[channel])
250+
throw love::Exception("Failed to acquire AXVoice!");
266251

267252
UniqueVoiceScope scope(this->buffer.voices[channel]);
268253
AXSetVoiceType(this->buffer.voices[channel], AX_VOICE_TYPE_UNKNOWN);
@@ -290,7 +275,7 @@ namespace love
290275
AXGetVoiceOffsets(this->buffer.voices[0], &offsets);
291276
const auto running = AXIsVoiceRunning(this->buffer.voices[0]);
292277

293-
return offsets.currentOffset == offsets.endOffset || (!running && offsets.currentOffset == 0);
278+
return (offsets.currentOffset == offsets.endOffset) || (!running && offsets.currentOffset == 0);
294279
}
295280

296281
void Buffer::prepare(const void* data, size_t size, int samples, bool own)

source/modules/joystick/JoystickModule.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ namespace love
1212
void extensionCallback(WPADChan channel, WPADExtensionType extension)
1313
{
1414
auto* instance = Module::getInstance<JoystickModule>(Module::M_JOYSTICK);
15-
LOG("ExtensionCallback: channel=%d, extension=%d", channel, extension);
1615
instance->addJoystick(channel + 1);
1716
}
1817

1918
void connectCallback(WPADChan channel, WPADError error)
2019
{
21-
LOG("ConnectCallback: channel=%d, error=%d", channel, error);
2220
EventQueue::getInstance().sendJoystickStatus(false, channel + 1);
2321
}
2422
#endif
@@ -102,8 +100,6 @@ namespace love
102100
break;
103101
}
104102
}
105-
LOG("addJoystick: deviceId=%lld, guid=%s, reused=%d", deviceId, guid.c_str(), reused);
106-
LOG("addJoystick: %p", joystick);
107103
if (!joystick)
108104
{
109105
joystick = love::joystick::openJoystick(this->joysticks.size());
@@ -114,7 +110,7 @@ namespace love
114110

115111
if (!joystick->open(deviceId))
116112
return nullptr;
117-
LOG("addJoystick: open success, handle=%p", (void*)joystick->getHandle());
113+
118114
for (auto* activeStick : this->activeSticks)
119115
{
120116
if (joystick->getHandle() == activeStick->getHandle())
@@ -125,14 +121,13 @@ namespace love
125121
this->joysticks.remove(joystick);
126122
joystick->release();
127123
}
128-
LOG("addJoystick: handle conflict, returning active stick");
129124
return activeStick;
130125
}
131126
}
132127

133128
if (joystick->isGamepad())
134129
this->recentGamepadGUIDs[joystick->getGUID()] = true;
135-
LOG("addJoystick: new joystick, handle=%p", (void*)joystick->getHandle());
130+
136131
this->activeSticks.push_back(joystick);
137132
return joystick;
138133
}

0 commit comments

Comments
 (0)