auto-create a blank fat32 sd card image if one does not exist, thanks to google :p
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3041 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
ea11b28e3d
commit
d2516e3ad1
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Version="9.00"
|
||||
Name="Common"
|
||||
ProjectGUID="{C573CAF7-EE6A-458E-8049-16C0BF34C2E9}"
|
||||
RootNamespace="Common"
|
||||
|
@ -712,6 +712,14 @@
|
|||
RelativePath=".\Src\SConscript"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\SDCardUtil.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\SDCardUtil.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\Setup.h"
|
||||
>
|
||||
|
|
|
@ -28,6 +28,7 @@ files = [
|
|||
"PluginWiimote.cpp",
|
||||
"PluginVideo.cpp",
|
||||
"PluginPAD.cpp",
|
||||
"SDCardUtil.cpp",
|
||||
"StringUtil.cpp",
|
||||
"Thread.cpp",
|
||||
"Thunk.cpp",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Version="9.00"
|
||||
Name="Core"
|
||||
ProjectGUID="{F0B874CB-4476-4199-9315-8343D05AE684}"
|
||||
RootNamespace="Core"
|
||||
|
@ -2191,22 +2191,6 @@
|
|||
RelativePath=".\Src\IPC_HLE\WiiMote_HID_Attr.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="HW"
|
||||
>
|
||||
<Filter
|
||||
Name="SDIO - SD Interface"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Src\IPC_HLE\HW\SDInterface.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\IPC_HLE\HW\SDInterface.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\Src\ConfigManager.cpp"
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program 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, version 2.0.
|
||||
|
||||
// This program 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 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
// HW Address: 0d07xxxx
|
||||
|
||||
#include "SDInterface.h"
|
||||
|
||||
namespace SDInterface
|
||||
{
|
||||
|
||||
bool g_bIsCardInserted = false;
|
||||
bool g_bIsDumpFile = false;
|
||||
std::string sourcePath = "";
|
||||
|
||||
bool IsCardInserted()
|
||||
{
|
||||
return g_bIsCardInserted;
|
||||
}
|
||||
|
||||
void SetSourceType(bool isDumpFile)
|
||||
{
|
||||
g_bIsDumpFile = isDumpFile;
|
||||
}
|
||||
|
||||
void SetSourcePath(const std::string path)
|
||||
{
|
||||
sourcePath = path;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
// Copyright (C) 2003-2009 Dolphin Project.
|
||||
|
||||
// This program 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, version 2.0.
|
||||
|
||||
// This program 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 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _SDINTERFACE_H
|
||||
#define _SDINTERFACE_H
|
||||
|
||||
#include "Common.h"
|
||||
#include <string>
|
||||
|
||||
namespace SDInterface
|
||||
{
|
||||
bool IsCardInserted();
|
||||
void SetSourceType(bool isDumpFile);
|
||||
void SetSourcePath(const std::string path);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -17,15 +17,14 @@
|
|||
|
||||
#include "Common.h"
|
||||
|
||||
#include "SDCardUtil.h"
|
||||
|
||||
#include "WII_IPC_HLE_Device_sdio_slot0.h"
|
||||
|
||||
#include "../HW/CPU.h"
|
||||
#include "../HW/Memmap.h"
|
||||
#include "HW/SDInterface.h"
|
||||
#include "../Core.h"
|
||||
|
||||
using namespace SDInterface;
|
||||
|
||||
CWII_IPC_HLE_Device_sdio_slot0::CWII_IPC_HLE_Device_sdio_slot0(u32 _DeviceID, const std::string& _rDeviceName)
|
||||
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
|
||||
{
|
||||
|
@ -46,9 +45,21 @@ bool CWII_IPC_HLE_Device_sdio_slot0::Open(u32 _CommandAddress, u32 _Mode)
|
|||
{
|
||||
INFO_LOG(WII_IPC_SD, "Open");
|
||||
|
||||
m_Card = fopen("sd.raw", "r+b");
|
||||
char filename[16] = "sd.raw";
|
||||
m_Card = fopen(filename, "r+b");
|
||||
if(!m_Card)
|
||||
ERROR_LOG(WII_IPC_SD, "Failed to open SD Card image");
|
||||
{
|
||||
WARN_LOG(WII_IPC_SD, "Failed to open SD Card image, trying to create a new 128MB image...");
|
||||
if (SDCardCreate(128, filename))
|
||||
{
|
||||
WARN_LOG(WII_IPC_SD, "Successfully created %s", filename);
|
||||
m_Card = fopen(filename, "r+b");
|
||||
}
|
||||
if(!m_Card)
|
||||
{
|
||||
ERROR_LOG(WII_IPC_SD, "Could not open SD Card image or create a new one, are you running from a read-only directory?");
|
||||
}
|
||||
}
|
||||
|
||||
Memory::Write_U32(GetDeviceID(), _CommandAddress + 0x4);
|
||||
return true;
|
||||
|
@ -58,7 +69,8 @@ bool CWII_IPC_HLE_Device_sdio_slot0::Close(u32 _CommandAddress)
|
|||
{
|
||||
INFO_LOG(WII_IPC_SD, "Close");
|
||||
|
||||
fclose(m_Card);
|
||||
if(m_Card)
|
||||
fclose(m_Card);
|
||||
|
||||
Memory::Write_U32(0, _CommandAddress + 0x4);
|
||||
return true;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
// PRELIMINARY - doesn't work yet
|
||||
// PRELIMINARY - seems to fully work with libogc, writing has yet to be tested
|
||||
|
||||
#ifndef _WII_IPC_HLE_DEVICE_SDIO_SLOT0_H_
|
||||
#define _WII_IPC_HLE_DEVICE_SDIO_SLOT0_H_
|
||||
|
|
|
@ -59,7 +59,6 @@ files = ["ActionReplay.cpp",
|
|||
"HW/VideoInterface.cpp",
|
||||
"HW/WII_IOB.cpp",
|
||||
"HW/WII_IPC.cpp",
|
||||
"IPC_HLE/HW/SDInterface.cpp",
|
||||
"IPC_HLE/WII_IPC_HLE.cpp",
|
||||
"IPC_HLE/WII_IPC_HLE_Device_DI.cpp",
|
||||
"IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp",
|
||||
|
|
Loading…
Reference in New Issue