* bump version number
* feed system time into RTC * start laying base for sound
This commit is contained in:
parent
3a61ed0a91
commit
28cddadfbc
|
@ -160,6 +160,8 @@
|
||||||
<Unit filename="src/RTC.h" />
|
<Unit filename="src/RTC.h" />
|
||||||
<Unit filename="src/SPI.cpp" />
|
<Unit filename="src/SPI.cpp" />
|
||||||
<Unit filename="src/SPI.h" />
|
<Unit filename="src/SPI.h" />
|
||||||
|
<Unit filename="src/SPU.cpp" />
|
||||||
|
<Unit filename="src/SPU.h" />
|
||||||
<Unit filename="src/Wifi.cpp" />
|
<Unit filename="src/Wifi.cpp" />
|
||||||
<Unit filename="src/Wifi.h" />
|
<Unit filename="src/Wifi.h" />
|
||||||
<Unit filename="src/types.h" />
|
<Unit filename="src/types.h" />
|
||||||
|
|
43
src/RTC.cpp
43
src/RTC.cpp
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
#include "RTC.h"
|
#include "RTC.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,6 +74,12 @@ void Reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
u8 BCD(u8 val)
|
||||||
|
{
|
||||||
|
return (val % 10) | ((val / 10) << 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ByteIn(u8 val)
|
void ByteIn(u8 val)
|
||||||
{
|
{
|
||||||
//printf("RTC IN: %02X\n", val);
|
//printf("RTC IN: %02X\n", val);
|
||||||
|
@ -94,21 +101,33 @@ void ByteIn(u8 val)
|
||||||
case 0x40: Output[0] = StatusReg2; break;
|
case 0x40: Output[0] = StatusReg2; break;
|
||||||
|
|
||||||
case 0x20:
|
case 0x20:
|
||||||
// TODO: get actual system time
|
{
|
||||||
Output[0] = 0x17;
|
time_t timestamp;
|
||||||
Output[1] = 0x01;
|
struct tm* timedata;
|
||||||
Output[2] = 0x19;
|
time(×tamp);
|
||||||
Output[3] = 0x04; // day of week. checkme. apparently 04=Thursday
|
timedata = localtime(×tamp);
|
||||||
Output[4] = 0x06;
|
|
||||||
Output[5] = 0x30;
|
Output[0] = BCD(timedata->tm_year - 100);
|
||||||
Output[6] = 0x30;
|
Output[1] = BCD(timedata->tm_mon + 1);
|
||||||
|
Output[2] = BCD(timedata->tm_mday);
|
||||||
|
Output[3] = BCD(timedata->tm_wday);
|
||||||
|
Output[4] = BCD(timedata->tm_hour);
|
||||||
|
Output[5] = BCD(timedata->tm_min);
|
||||||
|
Output[6] = BCD(timedata->tm_sec);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x60:
|
case 0x60:
|
||||||
// TODO: get actual system time
|
{
|
||||||
Output[0] = 0x06;
|
time_t timestamp;
|
||||||
Output[1] = 0x30;
|
struct tm* timedata;
|
||||||
Output[2] = 0x30;
|
time(×tamp);
|
||||||
|
timedata = localtime(×tamp);
|
||||||
|
|
||||||
|
Output[0] = BCD(timedata->tm_hour);
|
||||||
|
Output[1] = BCD(timedata->tm_min);
|
||||||
|
Output[2] = BCD(timedata->tm_sec);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x10:
|
case 0x10:
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
Copyright 2016-2017 StapleButter
|
||||||
|
|
||||||
|
This file is part of melonDS.
|
||||||
|
|
||||||
|
melonDS is free software: you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License as published by the Free
|
||||||
|
Software Foundation, either version 3 of the License, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
melonDS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with melonDS. If not, see http://www.gnu.org/licenses/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "NDS.h"
|
||||||
|
#include "SPU.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace SPU
|
||||||
|
{
|
||||||
|
|
||||||
|
//SDL_AudioDeviceID device;
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
bool Init()
|
||||||
|
{
|
||||||
|
/*SDL_AudioSpec whatIwant, whatIget;
|
||||||
|
|
||||||
|
memset(&whatIwant, 0, sizeof(SDL_AudioSpec));
|
||||||
|
whatIwant.freq = 32824; // 32823.6328125
|
||||||
|
whatIwant.format = AUDIO_S16LSB;
|
||||||
|
whatIwant.channels = 2;
|
||||||
|
whatIwant.samples = 2048;
|
||||||
|
whatIwant.callback = zorp;
|
||||||
|
device = SDL_OpenAudioDevice(NULL, 0, &whatIwant, &whatIget, 0);
|
||||||
|
if (!device)
|
||||||
|
{
|
||||||
|
printf("Audio init failed: %s\n", SDL_GetError());
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeInit()
|
||||||
|
{
|
||||||
|
//if (device) SDL_CloseAudioDevice(device);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Reset()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
Copyright 2016-2017 StapleButter
|
||||||
|
|
||||||
|
This file is part of melonDS.
|
||||||
|
|
||||||
|
melonDS is free software: you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License as published by the Free
|
||||||
|
Software Foundation, either version 3 of the License, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
melonDS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with melonDS. If not, see http://www.gnu.org/licenses/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SPU_H
|
||||||
|
#define SPU_H
|
||||||
|
|
||||||
|
namespace SPU
|
||||||
|
{
|
||||||
|
|
||||||
|
bool Init();
|
||||||
|
void DeInit();
|
||||||
|
void Reset();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // SPU_H
|
|
@ -19,7 +19,7 @@
|
||||||
#ifndef VERSION_H
|
#ifndef VERSION_H
|
||||||
#define VERSION_H
|
#define VERSION_H
|
||||||
|
|
||||||
#define MELONDS_VERSION "0.1"
|
#define MELONDS_VERSION "0.2"
|
||||||
|
|
||||||
#define MELONDS_URL "http://melonds.kuribo64.net/"
|
#define MELONDS_URL "http://melonds.kuribo64.net/"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue