mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
This is a HUUUUUUUUUUUUUUUUUUUUUUGE commit, Make sure I didn't break too much ;p
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@926 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
247
Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp
Normal file
247
Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp
Normal file
@ -0,0 +1,247 @@
|
||||
// Copyright (C) 2003-2008 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/
|
||||
|
||||
#include "Memmap.h"
|
||||
|
||||
#include "../Core.h"
|
||||
|
||||
#include "EXI_Device.h"
|
||||
#include "EXI_DeviceEthernet.h"
|
||||
u32 ReadP, WriteP;
|
||||
CEXIETHERNET::CEXIETHERNET() :
|
||||
m_uPosition(0),
|
||||
m_uCommand(0)
|
||||
{
|
||||
ID = 0x04020200;
|
||||
}
|
||||
|
||||
void CEXIETHERNET::SetCS(int cs)
|
||||
{
|
||||
if (cs)
|
||||
{
|
||||
ReadP = WriteP = INVALID_P;
|
||||
m_uPosition = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool CEXIETHERNET::IsPresent()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEXIETHERNET::Update()
|
||||
{
|
||||
return;
|
||||
}
|
||||
bool CEXIETHERNET::IsInterruptSet()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void CEXIETHERNET::TransferByte(u8& _byte)
|
||||
{
|
||||
//printf("%x %x POS: %d\n", _byte, m_uCommand, m_uPosition);
|
||||
//printf("%x %x \n", _byte, m_uCommand);
|
||||
if (m_uPosition == 0)
|
||||
{
|
||||
m_uCommand = _byte;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(m_uCommand)
|
||||
{
|
||||
default:
|
||||
printf("%x %x POS: %d Byte\n", _byte, m_uCommand, m_uPosition);
|
||||
}
|
||||
}
|
||||
m_uPosition++;
|
||||
}
|
||||
bool isActivated()
|
||||
{
|
||||
// Todo: Return actual check
|
||||
return true;
|
||||
}
|
||||
#ifndef _WIN32
|
||||
inline u32 _rotl(u32 x, int shift) {
|
||||
return (x << shift) | (x >> (32 - shift));
|
||||
}
|
||||
#endif
|
||||
void CEXIETHERNET::ImmWrite(u32 _uData, u32 _uSize)
|
||||
{
|
||||
while (_uSize--)
|
||||
{
|
||||
u8 uByte = _uData >> 24;
|
||||
if(WriteP != INVALID_P)
|
||||
{
|
||||
if(m_uPosition == 0)
|
||||
m_uCommand = uByte;
|
||||
else
|
||||
{
|
||||
switch(uByte)
|
||||
{
|
||||
case 0x0:
|
||||
// Reads the ID in ImmRead after this//
|
||||
break;
|
||||
case 0x1: /* Network Control Register A, RW */
|
||||
// Taken from WhineCube //
|
||||
#define RISE(flags) ((uByte & (flags)) && !(RegisterBlock[0x00] & (flags)))
|
||||
if(RISE(BBA_NCRA_RESET)) {
|
||||
printf("BBA Reset\n");
|
||||
}
|
||||
if(RISE(BBA_NCRA_SR) && isActivated()) {
|
||||
printf("BBA Start Recieve\n");
|
||||
//HWGLE(startRecv());
|
||||
}
|
||||
if(RISE(BBA_NCRA_ST1)) {
|
||||
printf("BBA Start Transmit\n");
|
||||
if(!mReadyToSend)
|
||||
{
|
||||
printf("Not ready to Send!\n");
|
||||
exit(0);
|
||||
}
|
||||
//HWGLE(sendPacket(mWriteBuffer.p(), mWriteBuffer.size()));
|
||||
mReadyToSend = false;
|
||||
}
|
||||
//#define MAKE(type, arg) (*(type *)&(arg))
|
||||
RegisterBlock[0x00] = *(u8*)&uByte;
|
||||
break;
|
||||
case 0x42:
|
||||
case 0x40: // Should be written
|
||||
memcpy(RegisterBlock + WriteP, &uByte, _uSize);
|
||||
WriteP = WriteP + _uSize;
|
||||
break;
|
||||
default:
|
||||
printf("%x %x POS: %d Size: %x IMMW POS\n", uByte, m_uCommand, m_uPosition, _uSize);
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_uSize == 2 && uByte == 0)
|
||||
{
|
||||
//printf("BBA device ID read\n");
|
||||
m_uCommand = uByte;
|
||||
return;
|
||||
} else if((_uSize == 4 && (_uData & 0xC0000000) == 0xC0000000) ||
|
||||
( _uSize == 2 && (_uData & 0x4000) == 0x4000)) { //Write to BBA register
|
||||
/*
|
||||
inline DWORD makemaskw(int start, int end) {
|
||||
return _rotl((2 << (end - start)) - 1, 31 - end);
|
||||
}
|
||||
inline DWORD getbitsw(DWORD dword, int start, int end) {
|
||||
return (dword & makemaskw(start, end)) >> (31 - end);
|
||||
}*/
|
||||
if( _uSize == 4)
|
||||
WriteP = (u8)(_uData & (_rotl((2 << ( 23 - 16)) - 1, 23)) >> (31 - 23));
|
||||
//WriteP = (BYTE)getbitsw(data, 16, 23);
|
||||
else //size == 2
|
||||
WriteP = (u8)((_uData & ~0x4000) & (_rotl((2 << ( 23 - 16)) - 1, 23)) >> (31 - 23));
|
||||
//WriteP = (BYTE)getbitsw(data & ~0x4000, 16, 23); //Dunno about this...
|
||||
if(WriteP == 0x48) {
|
||||
//mWriteBuffer.clear();
|
||||
//mExpectVariableLengthImmWrite = true;
|
||||
printf("Prepared for variable length write to address 0x48\n");
|
||||
} else {
|
||||
printf("BBA Write pointer set to 0x%0*X\n", _uSize, WriteP);
|
||||
}
|
||||
return;
|
||||
}
|
||||
//TransferByte(uByte);
|
||||
m_uPosition++;
|
||||
_uData <<= 8;
|
||||
}
|
||||
}
|
||||
u32 CEXIETHERNET::ImmRead(u32 _uSize)
|
||||
{
|
||||
u32 uResult = 0;
|
||||
u32 uPosition = 0;
|
||||
while (_uSize--)
|
||||
{
|
||||
u8 uByte = 0;
|
||||
switch(m_uCommand)
|
||||
{
|
||||
case 0x0:
|
||||
{
|
||||
switch(m_uPosition)
|
||||
{
|
||||
case 1:
|
||||
_dbg_assert_(EXPANSIONINTERFACE, (uByte == 0x00));
|
||||
break;
|
||||
default:
|
||||
//Todo: Could just return the ID here
|
||||
uByte = (u8)(ID >> (24-(((m_uPosition - 2) & 3) * 8)));
|
||||
printf("Returned ID\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("%x %x POS: %d Size: %x IMMR\n", uByte, m_uCommand, m_uPosition, _uSize);
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
//TransferByte(uByte);
|
||||
uResult |= uByte << (24-(uPosition++ * 8));
|
||||
m_uPosition++;
|
||||
}
|
||||
return uResult;
|
||||
}
|
||||
|
||||
void CEXIETHERNET::DMAWrite(u32 _uAddr, u32 _uSize)
|
||||
{
|
||||
// _dbg_assert_(EXPANSIONINTERFACE, 0);
|
||||
while (_uSize--)
|
||||
{
|
||||
u8 uByte = Memory::Read_U8(_uAddr++);
|
||||
if(m_uPosition == 0)
|
||||
m_uCommand = uByte;
|
||||
else
|
||||
{
|
||||
switch(m_uCommand)
|
||||
{
|
||||
default:
|
||||
printf("%x %x POS: %d DMAW\n", uByte, m_uCommand, m_uPosition);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//TransferByte(uByte);
|
||||
m_uPosition++;
|
||||
}
|
||||
}
|
||||
|
||||
void CEXIETHERNET::DMARead(u32 _uAddr, u32 _uSize)
|
||||
{
|
||||
// _dbg_assert_(EXPANSIONINTERFACE, 0);
|
||||
while (_uSize--)
|
||||
{
|
||||
u8 uByte = 0;
|
||||
if(m_uPosition == 0)
|
||||
m_uCommand = uByte;
|
||||
else
|
||||
{
|
||||
switch(m_uCommand)
|
||||
{
|
||||
default:
|
||||
printf("%x %x POS: %d DMAR\n", uByte, m_uCommand, m_uPosition);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//TransferByte(uByte);
|
||||
m_uPosition++;
|
||||
Memory::Write_U8(uByte, _uAddr++);
|
||||
}
|
||||
};
|
86
Source/Core/Core/Src/HW/EXI_DeviceEthernet.h
Normal file
86
Source/Core/Core/Src/HW/EXI_DeviceEthernet.h
Normal file
@ -0,0 +1,86 @@
|
||||
// Copyright (C) 2003-2008 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 _EXIDEVICE_ETHERNET_H
|
||||
#define _EXIDEVICE_ETHERNET_H
|
||||
|
||||
class CEXIETHERNET : public IEXIDevice
|
||||
{
|
||||
public:
|
||||
CEXIETHERNET();
|
||||
void SetCS(int _iCS);
|
||||
bool IsPresent();
|
||||
void Update();
|
||||
bool IsInterruptSet();
|
||||
void ImmWrite(u32 _uData, u32 _uSize);
|
||||
u32 ImmRead(u32 _uSize);
|
||||
void DMAWrite(u32 _uAddr, u32 _uSize);
|
||||
void DMARead(u32 _uAddr, u32 _uSize);
|
||||
|
||||
private:
|
||||
// STATE_TO_SAVE
|
||||
u32 m_uPosition;
|
||||
u32 m_uCommand;
|
||||
bool mReadyToSend;
|
||||
unsigned int ID;
|
||||
u8 RegisterBlock[0x1000];
|
||||
|
||||
void TransferByte(u8& _uByte);
|
||||
};
|
||||
|
||||
// From Whinecube //
|
||||
|
||||
#define INVALID_P 0xFFFF
|
||||
|
||||
#define BBA_NCRA 0x00 /* Network Control Register A, RW */
|
||||
#define BBA_NCRA_RESET (1<<0) /* RESET */
|
||||
#define BBA_NCRA_ST0 (1<<1) /* ST0, Start transmit command/status */
|
||||
#define BBA_NCRA_ST1 (1<<2) /* ST1, " */
|
||||
#define BBA_NCRA_SR (1<<3) /* SR, Start Receive */
|
||||
|
||||
#define BBA_NCRB 0x01 /* Network Control Register B, RW */
|
||||
#define BBA_NCRB_PR (1<<0) /* PR, Promiscuous Mode */
|
||||
#define BBA_NCRB_CA (1<<1) /* CA, Capture Effect Mode */
|
||||
#define BBA_NCRB_PM (1<<2) /* PM, Pass Multicast */
|
||||
#define BBA_NCRB_PB (1<<3) /* PB, Pass Bad Frame */
|
||||
#define BBA_NCRB_AB (1<<4) /* AB, Accept Broadcast */
|
||||
#define BBA_NCRB_HBD (1<<5) /* HBD, reserved */
|
||||
#define BBA_NCRB_RXINTC0 (1<<6) /* RXINTC, Receive Interrupt Counter */
|
||||
#define BBA_NCRB_RXINTC1 (1<<7) /* " */
|
||||
#define BBA_NCRB_1_PACKET_PER_INT (0<<6) /* 0 0 */
|
||||
#define BBA_NCRB_2_PACKETS_PER_INT (1<<6) /* 0 1 */
|
||||
#define BBA_NCRB_4_PACKETS_PER_INT (2<<6) /* 1 0 */
|
||||
#define BBA_NCRB_8_PACKETS_PER_INT (3<<6) /* 1 1 */
|
||||
|
||||
#define BBA_NWAYC 0x30 /* NWAY Configuration Register, RW, 84h */
|
||||
#define BBA_NWAYC_FD (1<<0) /* FD, Full Duplex Mode */
|
||||
#define BBA_NWAYC_PS100 (1<<1) /* PS100/10, Port Select 100/10 */
|
||||
#define BBA_NWAYC_ANE (1<<2) /* ANE, Autonegotiation Enable */
|
||||
#define BBA_NWAYC_ANS_RA (1<<3) /* ANS, Restart Autonegotiation */
|
||||
#define BBA_NWAYC_LTE (1<<7) /* LTE, Link Test Enable */
|
||||
|
||||
#define BBA_NWAYS 0x31
|
||||
#define BBA_NWAYS_LS10 (1<<0)
|
||||
#define BBA_NWAYS_LS100 (1<<1)
|
||||
#define BBA_NWAYS_LPNWAY (1<<2)
|
||||
#define BBA_NWAYS_ANCLPT (1<<3)
|
||||
#define BBA_NWAYS_100TXF (1<<4)
|
||||
#define BBA_NWAYS_100TXH (1<<5)
|
||||
#define BBA_NWAYS_10TXF (1<<6)
|
||||
#define BBA_NWAYS_10TXH (1<<7)
|
||||
|
||||
#endif
|
@ -97,6 +97,7 @@ private:
|
||||
};
|
||||
|
||||
SOrigin m_origin;
|
||||
int DeviceNum;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -56,6 +56,7 @@ files = ["Console.cpp",
|
||||
"IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp",
|
||||
"IPC_HLE/WII_IPC_HLE_Device_usb.cpp",
|
||||
"IPC_HLE/WII_IPC_HLE_WiiMote.cpp",
|
||||
"IPC_HLE/WiiMote_HID_Attr.cpp",
|
||||
"Plugins/Plugin_DSP.cpp",
|
||||
"Plugins/Plugin_PAD.cpp",
|
||||
"Plugins/Plugin_Video.cpp",
|
||||
|
@ -70,8 +70,10 @@ CLogWindow::CLogWindow(wxWindow* parent)
|
||||
m_options->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
||||
m_options->SetMinSize(wxSize(m_options->GetSize().GetWidth() - 40,
|
||||
m_options->GetCount() * 15));
|
||||
#ifdef _WIN32
|
||||
for (int i = 0; i < m_options->GetCount(); ++i)
|
||||
m_options->GetItem(i)->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
||||
#endif
|
||||
|
||||
m_checks = new wxCheckListBox(this, IDM_LOGCHECKS, wxDefaultPosition, wxSize(120, 280));
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#ifndef __CONFIG_MAIN_h__
|
||||
#define __CONFIG_MAIN_h__
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/gbsizer.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/filepicker.h>
|
||||
|
@ -18,6 +18,7 @@
|
||||
#ifndef __FILESYSTEM_VIEWER_h__
|
||||
#define __FILESYSTEM_VIEWER_h__
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/filepicker.h>
|
||||
#include <wx/statbmp.h>
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "MemcardManager.h"
|
||||
|
||||
#include <wx/mstream.h>
|
||||
#include <wx/aboutdlg.h>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// resources
|
||||
|
@ -1,9 +1,10 @@
|
||||
#ifndef __FRAME_H_
|
||||
#define __FRAME_H_
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/busyinfo.h>
|
||||
class CGameListCtrl;
|
||||
class CFrame
|
||||
: public wxFrame
|
||||
class CFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -293,7 +293,7 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
|
||||
// Item data
|
||||
SetItemData(_Index, ItemIndex);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
bool CGameListCtrl::MSWDrawSubItem(wxPaintDC& rPaintDC, int item, int subitem)
|
||||
{
|
||||
bool Result = false;
|
||||
@ -315,6 +315,7 @@ bool CGameListCtrl::MSWDrawSubItem(wxPaintDC& rPaintDC, int item, int subitem)
|
||||
|
||||
return(Result);
|
||||
}
|
||||
#endif
|
||||
|
||||
wxColour blend50(const wxColour& c1, const wxColour& c2)
|
||||
{
|
||||
|
@ -78,7 +78,9 @@ private:
|
||||
void OnMultiDecompressGCM(wxCommandEvent& event);
|
||||
void OnFilesystemViewer(wxCommandEvent& event);
|
||||
|
||||
#ifdef _WIN32
|
||||
virtual bool MSWDrawSubItem(wxPaintDC& rPaintDC, int item, int subitem);
|
||||
#endif
|
||||
|
||||
void CompressSelection(bool _compress);
|
||||
void AutomaticColumnWidth();
|
||||
|
@ -86,7 +86,7 @@ enum
|
||||
//#include <wx/wxprec.h>
|
||||
|
||||
//#ifndef WX_PRECOMP
|
||||
#if !defined(_LP64) && !defined(__APPLE__)
|
||||
#if !defined(__APPLE__)
|
||||
#include <wx/wx.h>
|
||||
//#endif
|
||||
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
bool IsCompressed() const {return m_BlobCompressed;}
|
||||
u64 GetFileSize() const {return m_FileSize;}
|
||||
u64 GetVolumeSize() const {return m_VolumeSize;}
|
||||
#if !defined(_LP64) && !defined(__APPLE__)
|
||||
#if !defined(__APPLE__)
|
||||
const wxImage& GetImage() const {return m_Image;}
|
||||
#endif
|
||||
|
||||
@ -52,7 +52,7 @@ private:
|
||||
|
||||
DiscIO::IVolume::ECountry m_Country;
|
||||
|
||||
#if !defined(_LP64) && !defined(__APPLE__)
|
||||
#if !defined(__APPLE__)
|
||||
wxImage m_Image;
|
||||
#endif
|
||||
bool m_Valid;
|
||||
|
@ -71,19 +71,19 @@ wxBitmap wxBitmapFromMemoryRGBA(const unsigned char* data, int width, int height
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(CMemcardManager, wxDialog)
|
||||
EVT_CLOSE(OnClose)
|
||||
EVT_BUTTON(ID_COPYLEFT,CopyDeleteClick)
|
||||
EVT_BUTTON(ID_COPYRIGHT,CopyDeleteClick)
|
||||
EVT_BUTTON(ID_FIXCHECKSUM,CopyDeleteClick)
|
||||
EVT_BUTTON(ID_DELETELEFT,CopyDeleteClick)
|
||||
EVT_BUTTON(ID_DELETERIGHT,CopyDeleteClick)
|
||||
EVT_BUTTON(ID_SAVEIMPORTRIGHT,CopyDeleteClick)
|
||||
EVT_BUTTON(ID_SAVEEXPORTRIGHT,CopyDeleteClick)
|
||||
EVT_BUTTON(ID_SAVEIMPORTLEFT,CopyDeleteClick)
|
||||
EVT_BUTTON(ID_SAVEEXPORTLEFT,CopyDeleteClick)
|
||||
EVT_BUTTON(ID_CONVERTTOGCI,CopyDeleteClick)
|
||||
EVT_FILEPICKER_CHANGED(ID_MEMCARD1PATH,OnPathChange)
|
||||
EVT_FILEPICKER_CHANGED(ID_MEMCARD2PATH,OnPathChange)
|
||||
EVT_CLOSE(CMemcardManager::OnClose)
|
||||
EVT_BUTTON(ID_COPYLEFT,CMemcardManager::CopyDeleteClick)
|
||||
EVT_BUTTON(ID_COPYRIGHT,CMemcardManager::CopyDeleteClick)
|
||||
EVT_BUTTON(ID_FIXCHECKSUM,CMemcardManager::CopyDeleteClick)
|
||||
EVT_BUTTON(ID_DELETELEFT,CMemcardManager::CopyDeleteClick)
|
||||
EVT_BUTTON(ID_DELETERIGHT,CMemcardManager::CopyDeleteClick)
|
||||
EVT_BUTTON(ID_SAVEIMPORTRIGHT,CMemcardManager::CopyDeleteClick)
|
||||
EVT_BUTTON(ID_SAVEEXPORTRIGHT,CMemcardManager::CopyDeleteClick)
|
||||
EVT_BUTTON(ID_SAVEIMPORTLEFT,CMemcardManager::CopyDeleteClick)
|
||||
EVT_BUTTON(ID_SAVEEXPORTLEFT,CMemcardManager::CopyDeleteClick)
|
||||
EVT_BUTTON(ID_CONVERTTOGCI,CMemcardManager::CopyDeleteClick)
|
||||
EVT_FILEPICKER_CHANGED(ID_MEMCARD1PATH,CMemcardManager::OnPathChange)
|
||||
EVT_FILEPICKER_CHANGED(ID_MEMCARD2PATH,CMemcardManager::OnPathChange)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
CMemcardManager::CMemcardManager(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
|
||||
@ -206,7 +206,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
|
||||
int index1 = m_MemcardList[1]->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
||||
int slot = 1;
|
||||
int index2 = index1;
|
||||
char * fileName2 = NULL;
|
||||
std::string fileName2 = NULL;
|
||||
|
||||
switch(event.GetId())
|
||||
{
|
||||
@ -234,11 +234,10 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
|
||||
}
|
||||
break;
|
||||
case ID_CONVERTTOGCI:
|
||||
fileName2 = new char;
|
||||
case ID_SAVEIMPORTLEFT:
|
||||
slot = 0;
|
||||
case ID_SAVEIMPORTRIGHT:
|
||||
if (memoryCard[slot] != NULL || fileName2 != NULL)
|
||||
if (memoryCard[slot] != NULL || !fileName2.empty())
|
||||
{
|
||||
wxString temp = wxFileSelector(_T("Select the GCI file to import"),
|
||||
wxEmptyString, wxEmptyString, wxEmptyString,wxString::Format
|
||||
@ -252,7 +251,7 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
|
||||
),
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST);
|
||||
const char * fileName = temp.ToAscii();
|
||||
if (*fileName2 != NULL && !temp.empty())
|
||||
if (!fileName2.empty() && !temp.empty())
|
||||
{
|
||||
wxString temp2 = wxFileSelector(_T("Save GCI as.."),
|
||||
wxEmptyString, wxEmptyString, _T(".gci"), wxString::Format
|
||||
@ -262,12 +261,11 @@ void CMemcardManager::CopyDeleteClick(wxCommandEvent& event)
|
||||
wxFileSelectorDefaultWildcardStr
|
||||
),
|
||||
wxFD_OVERWRITE_PROMPT|wxFD_SAVE);
|
||||
delete fileName2;
|
||||
fileName2 = (char*)temp2.ToAscii();
|
||||
fileName2 = temp2.mb_str();
|
||||
}
|
||||
if (temp.length() > 0)
|
||||
{
|
||||
switch(memoryCard[slot]->ImportGci(fileName, fileName2))
|
||||
switch(memoryCard[slot]->ImportGci(fileName, fileName2.c_str()))
|
||||
{
|
||||
case LENGTHFAIL:
|
||||
wxMessageBox(wxT("Imported file has invalid length"),
|
||||
|
Reference in New Issue
Block a user