WiiFlow_Lite/source/dml/dml.c
fix94.1 afdd19e591 wiiflow r417 mod5, changes:
r417 -> r417mod
-Added very basic DML support (many thanks to the postloader code)
-Re-added IOS reload
-Added cIOS base 60, 70 and 80 as compatible ones for d2x v8+

r417mod -> r417mod2
-Fixed NTSC video mode

r417mod2 -> r417mod3
-Fixed black wii game covers if no WiiTDB file exist, forcing to white now
-Set default gamecube game cover to black
-Added DML icon
-Compressed all PNG files to save space
-May fixed codedump if IOS58 games started from DVD (thanks entropy)
-Allowing access to the homebrew screen while parental controls are enabled (thanks entropy)
-Disable cover downloads while parental controls are enabled (thanks entropy)

r417mod3 -> r417mod4
-fixed DML audio streaming if NAND emulator was enabled before
-removed DVD boot from DML launch, makes boot process way faster (still needs a disc inserted)
-Added base IOS58 to DVD launch list, may really fixes IOS58 games from DVD :P

r417mod4 -> r417mod5
-added yellow covers for "Mario & Sonic at the London 2012 Olympic Games" PAL and NTSC-U
-fixed black covers for "Pandora’s Tower: Until I Return to Your Side" and "Ikenie no Yoru" NTSC-J
-removed some options in DML coverflow because they doesnt work
-fixed global options in DML coverflow
-fixed gametdb titles and synopsis (see http://gbatemp.net/topic/204106-wiiflow-an-open-source-gui-usb-loader/page__st__4515__p__3950858#entry3950858)
-moved IOS selection to new page 4
2012-01-21 21:15:45 +00:00

91 lines
2.0 KiB
C

#include <stdint.h>
#include <string.h>
#include <gccore.h>
#include <ogc/es.h>
#include <ogc/video_types.h>
#include <dirent.h>
#include <stdio.h>
#include <stdarg.h>
#include <malloc.h>
#include <math.h>
#include <ogcsys.h>
#include <unistd.h>
#include <sys/statvfs.h>
#include "dml.h"
#define SEP 0xFF
#define BC 0x0000000100000100ULL
#define MIOS 0x0000000100000101ULL
/** Base address for video registers. */
#define MEM_VIDEO_BASE (0xCC002000)
#define IOCTL_DI_DVDLowAudioBufferConfig 0xE4
#define VIDEO_MODE_NTSC 0
#define VIDEO_MODE_PAL 1
#define VIDEO_MODE_PAL60 2
#define VIDEO_MODE_NTSC480P 3
#define VIDEO_MODE_PAL480P 4
syssram* __SYS_LockSram();
u32 __SYS_UnlockSram(u32 write);
u32 __SYS_SyncSram(void);
s32 setstreaming()
{
char __di_fs[] ATTRIBUTE_ALIGN(32) = "/dev/di";
u32 bufferin[0x20] __attribute__((aligned(32)));
u32 bufferout[0x20] __attribute__((aligned(32)));
s32 __dvd_fd = -1;
u8 ioctl;
ioctl = IOCTL_DI_DVDLowAudioBufferConfig;
__dvd_fd = IOS_Open(__di_fs,0);
if(__dvd_fd < 0) return __dvd_fd;
memset(bufferin, 0, 0x20);
memset(bufferout, 0, 0x20);
bufferin[0] = (ioctl << 24);
if ( (*(u32*)0x80000008)>>24 )
{
bufferin[1] = 1;
if( ((*(u32*)0x80000008)>>16) & 0xFF )
bufferin[2] = 10;
else
bufferin[2] = 0;
}
else
{
bufferin[1] = 0;
bufferin[2] = 0;
}
DCFlushRange(bufferin, 0x20);
int Ret = IOS_Ioctl(__dvd_fd, ioctl, bufferin, 0x20, bufferout, 0x20);
IOS_Close(__dvd_fd);
return ((Ret == 1) ? 0 : -Ret);
}
void SRAM_PAL()
{
syssram *sram;
sram = __SYS_LockSram();
sram->flags = sram->flags | (1 << 0); // Set bit 0 to set the video mode to PAL
__SYS_UnlockSram(1); // 1 -> write changes
while(!__SYS_SyncSram());
}
void SRAM_NTSC()
{
syssram *sram;
sram = __SYS_LockSram();
sram->flags = sram->flags & ~(1 << 0); // Clear bit 0 to set the video mode to NTSC
__SYS_UnlockSram(1); // 1 -> write changes
while(!__SYS_SyncSram());
}