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:
parent
6faea5668a
commit
9692f3dd9e
|
@ -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++);
|
||||
}
|
||||
};
|
|
@ -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"),
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
#include "Globals.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
|
||||
#include "ImageWrite.h"
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#include "Globals.h"
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
|
||||
#include <Cg/cg.h>
|
||||
#include <Cg/cgGL.h>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "Globals.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
|
||||
#include "MemoryUtil.h"
|
||||
#include "Profiler.h"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "CPMemory.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
// TODO - clarify the role of this class.
|
||||
|
||||
// Methods to manage and cache the global state of vertex streams and flushing streams
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
SUBDIRS:= `ls | egrep -v '^(CVS)$$'`
|
||||
|
||||
all:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done;
|
||||
|
||||
clean:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done;
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||
endif
|
||||
|
||||
include $(DEVKITPPC)/gamecube_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(notdir $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
DATA := data
|
||||
INCLUDES :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
|
||||
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -logc -lm
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# automatically build a list of object files for our project
|
||||
#---------------------------------------------------------------------------------
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
export LD := $(CC)
|
||||
else
|
||||
export LD := $(CXX)
|
||||
endif
|
||||
|
||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
|
||||
$(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD) \
|
||||
-I$(LIBOGC_INC)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
|
||||
-L$(LIBOGC_LIB)
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).dol: $(OUTPUT).elf
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule links in binary data with the .jpg extension
|
||||
#---------------------------------------------------------------------------------
|
||||
%.jpg.o : %.jpg
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
$(bin2o)
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
|
@ -0,0 +1,53 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <ogcsys.h>
|
||||
#include <gccore.h>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
static void *xfb = NULL;
|
||||
static GXRModeObj *rmode = NULL;
|
||||
|
||||
void *Initialise();
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
xfb = Initialise();
|
||||
AUDIO_Init(NULL);
|
||||
AUDIO_SetStreamVolLeft(0xFF); // Max
|
||||
AUDIO_SetStreamVolRight(0xFF); // Max
|
||||
AUDIO_SetStreamSampleRate(AI_SAMPLERATE_48KHZ);
|
||||
while(1) {
|
||||
PAD_ScanPads();
|
||||
VIDEO_ClearFrameBuffer(rmode, xfb, 0);
|
||||
|
||||
|
||||
VIDEO_WaitVSync();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void * Initialise() {
|
||||
|
||||
void *framebuffer;
|
||||
|
||||
VIDEO_Init();
|
||||
PAD_Init();
|
||||
|
||||
rmode = VIDEO_GetPreferredMode(NULL);
|
||||
|
||||
framebuffer = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
|
||||
console_init(framebuffer,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
|
||||
|
||||
VIDEO_Configure(rmode);
|
||||
VIDEO_SetNextFramebuffer(framebuffer);
|
||||
VIDEO_SetBlack(FALSE);
|
||||
VIDEO_Flush();
|
||||
VIDEO_WaitVSync();
|
||||
if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
|
||||
|
||||
return framebuffer;
|
||||
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<Project name="template"><MagicFolder excludeFolders="CVS;.svn" filter="*.c;*.cpp;*.h" name="source" path="source\"><File path="template.c"></File></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*.h" name="include" path="include\"></MagicFolder><File path="Makefile"></File></Project>
|
|
@ -0,0 +1 @@
|
|||
<pd><ViewState><e p="template" x="true"></e><e p="template\source" x="true"></e></ViewState></pd>
|
|
@ -0,0 +1,8 @@
|
|||
SUBDIRS:= `ls | egrep -v '^(CVS)$$'`
|
||||
|
||||
all:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done;
|
||||
|
||||
clean:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done;
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
int main()
|
||||
{
|
||||
|
||||
};
|
|
@ -0,0 +1 @@
|
|||
<Project name="template"><MagicFolder excludeFolders="CVS;.svn" filter="*.c;*.cpp;*.h" name="source" path="source\"><File path="template.c"></File></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*.h" name="include" path="include\"></MagicFolder><File path="Makefile"></File></Project>
|
|
@ -0,0 +1 @@
|
|||
<pd><ViewState><e p="template" x="true"></e><e p="template\source" x="true"></e></ViewState></pd>
|
|
@ -8,7 +8,6 @@
|
|||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
#include <iostream>
|
||||
#include <debug.h>
|
||||
#include <math.h>
|
||||
|
||||
|
@ -61,7 +60,7 @@ int main()
|
|||
std::cout << "Device isn't Mem card in Slot A";
|
||||
else
|
||||
std::cout << "Got an error of " << error << " with slot A";
|
||||
std::cout << " ID of " << std::setbase(16) << ID << std::endl;
|
||||
std::cout << " ID of 0x" << std::setbase(16) << ID << std::endl;
|
||||
|
||||
std::cout << std::setbase(10);
|
||||
EXI_GetID(1, 0, &ID);
|
||||
|
@ -72,7 +71,7 @@ int main()
|
|||
std::cout << "Device isn't Mem card in Slot B";
|
||||
else
|
||||
std::cout << "Got an error of " << error << " with slot B";
|
||||
std::cout << " ID of " << std::setbase(16) << ID << std::endl;
|
||||
std::cout << " ID of 0x" << std::setbase(16) << ID << std::endl;
|
||||
VIDEO_WaitVSync();
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<Project name="template"><MagicFolder excludeFolders="CVS;.svn" filter="*.c;*.cpp;*.h" name="source" path="source\"><File path="template.c"></File></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*.h" name="include" path="include\"></MagicFolder><File path="Makefile"></File></Project>
|
|
@ -0,0 +1 @@
|
|||
<pd><ViewState><e p="template" x="true"></e><e p="template\source" x="true"></e></ViewState></pd>
|
|
@ -0,0 +1,131 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||
endif
|
||||
|
||||
include $(DEVKITPPC)/gamecube_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(notdir $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
DATA := data
|
||||
INCLUDES :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
|
||||
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -logc
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# automatically build a list of object files for our project
|
||||
#---------------------------------------------------------------------------------
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
export LD := $(CC)
|
||||
else
|
||||
export LD := $(CXX)
|
||||
endif
|
||||
|
||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
|
||||
$(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD) \
|
||||
-I$(LIBOGC_INC)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
|
||||
-L$(LIBOGC_LIB)
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).dol: $(OUTPUT).elf
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule links in binary data with the .jpg extension
|
||||
#---------------------------------------------------------------------------------
|
||||
%.jpg.o : %.jpg
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
$(bin2o)
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
|
@ -0,0 +1,319 @@
|
|||
/*---------------------------------------------------------------------------------
|
||||
|
||||
a simple rotating cube demo by tkcne
|
||||
|
||||
---------------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <math.h>
|
||||
#include <gccore.h>
|
||||
#include <gcmodplay.h>
|
||||
#include <debug.h>
|
||||
#include <ogcsys.h>
|
||||
|
||||
#define DEFAULT_FIFO_SIZE (256*1024) //GX_FIFO_MINSIZE
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// cube vertex data
|
||||
//---------------------------------------------------------------------------------
|
||||
s16 cube[] ATTRIBUTE_ALIGN(32) = {
|
||||
// x y z
|
||||
-15, 15, -15, // 0
|
||||
15, 15, -15, // 1
|
||||
15, 15, 15, // 2
|
||||
-15, 15, 15, // 3
|
||||
15, -15, -15, // 4
|
||||
15, -15, 15, // 5
|
||||
-15, -15, 15, // 6
|
||||
-15, -15, -15, // 7
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// color data
|
||||
//---------------------------------------------------------------------------------
|
||||
u8 colors[] ATTRIBUTE_ALIGN(32) = {
|
||||
// r, g, b, a
|
||||
100, 10, 100, 255, // 0 purple
|
||||
240, 0, 0, 255, // 1 red
|
||||
255, 180, 0, 255, // 2 orange
|
||||
255, 255, 0, 255, // 3 yellow
|
||||
10, 120, 40, 255, // 4 green
|
||||
0, 20, 100, 255 // 5 blue
|
||||
};
|
||||
|
||||
u32
|
||||
CvtRGB (u8 r1, u8 g1, u8 b1, u8 r2, u8 g2, u8 b2)
|
||||
{
|
||||
int y1, cb1, cr1, y2, cb2, cr2, cb, cr;
|
||||
|
||||
y1 = (299 * r1 + 587 * g1 + 114 * b1) / 1000;
|
||||
cb1 = (-16874 * r1 - 33126 * g1 + 50000 * b1 + 12800000) / 100000;
|
||||
cr1 = (50000 * r1 - 41869 * g1 - 8131 * b1 + 12800000) / 100000;
|
||||
|
||||
y2 = (299 * r2 + 587 * g2 + 114 * b2) / 1000;
|
||||
cb2 = (-16874 * r2 - 33126 * g2 + 50000 * b2 + 12800000) / 100000;
|
||||
cr2 = (50000 * r2 - 41869 * g2 - 8131 * b2 + 12800000) / 100000;
|
||||
|
||||
cb = (cb1 + cb2) >> 1;
|
||||
cr = (cr1 + cr2) >> 1;
|
||||
|
||||
return (y1 << 24) | (cb << 16) | (y2 << 8) | cr;
|
||||
}
|
||||
static u32 curr_fb = 0;
|
||||
static u32 first_frame = 1;
|
||||
static u32 *xfb[2] = {NULL,NULL};
|
||||
GXRModeObj *rmode;
|
||||
|
||||
void draw_init();
|
||||
void draw_cube(Mtx v);
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
int main( int argc, char **argv ){
|
||||
//---------------------------------------------------------------------------------
|
||||
f32 yscale;
|
||||
u32 xfbHeight;
|
||||
u32 colour1;
|
||||
Mtx v,p; // view and perspective matrices
|
||||
int CP = 0;
|
||||
GXColor background = {0, 0, 0, 0xff};
|
||||
int startx, starty;
|
||||
int directionx, directiony;
|
||||
|
||||
// init the vi. setup frame buffer and set the retrace callback
|
||||
// to copy the efb to xfb
|
||||
VIDEO_Init();
|
||||
PAD_Init();
|
||||
|
||||
rmode = VIDEO_GetPreferredMode(NULL);
|
||||
|
||||
|
||||
curr_fb = 0;
|
||||
first_frame = 0;
|
||||
|
||||
// setup the fifo and then init the flipper
|
||||
void *gp_fifo = NULL;
|
||||
gp_fifo = memalign(32,DEFAULT_FIFO_SIZE);
|
||||
memset(gp_fifo,0,DEFAULT_FIFO_SIZE);
|
||||
|
||||
xfb[0] = (u32 *) MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
|
||||
xfb[1] = (u32 *) MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
|
||||
|
||||
VIDEO_Configure(rmode);
|
||||
VIDEO_SetNextFramebuffer(xfb[curr_fb]);
|
||||
if(!first_frame) VIDEO_SetBlack(FALSE);
|
||||
VIDEO_Flush();
|
||||
VIDEO_WaitVSync();
|
||||
if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
|
||||
console_init(xfb[curr_fb],20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
|
||||
|
||||
//curr_fb ^= 1;
|
||||
|
||||
GX_Init(gp_fifo,DEFAULT_FIFO_SIZE);
|
||||
|
||||
// clears the bg to color and clears the z buffer
|
||||
GX_SetCopyClear(background, 0x00ffffff);
|
||||
|
||||
// other gx setup
|
||||
GX_SetViewport(0,0,rmode->fbWidth,rmode->efbHeight,0,1);
|
||||
yscale = GX_GetYScaleFactor(rmode->efbHeight,rmode->xfbHeight);
|
||||
xfbHeight = GX_SetDispCopyYScale(yscale);
|
||||
GX_SetScissor(0,0,rmode->fbWidth,rmode->efbHeight);
|
||||
GX_SetDispCopySrc(0,0,rmode->fbWidth,rmode->efbHeight);
|
||||
GX_SetDispCopyDst(rmode->fbWidth,xfbHeight);
|
||||
GX_SetCopyFilter(rmode->aa,rmode->sample_pattern,GX_TRUE,rmode->vfilter);
|
||||
GX_SetFieldMode(rmode->field_rendering,((rmode->viHeight==2*rmode->xfbHeight)?GX_ENABLE:GX_DISABLE));
|
||||
|
||||
// cull none because other values produce weird results
|
||||
GX_SetCullMode(GX_CULL_NONE);
|
||||
GX_CopyDisp(xfb[curr_fb],GX_TRUE);
|
||||
GX_SetDispCopyGamma(GX_GM_1_0);
|
||||
|
||||
// setup our camera at the origin
|
||||
// looking down the -z axis with y up
|
||||
Vector cam = {0.0F, 0.0F, 0.0F},
|
||||
up = {0.0F, 1.0F, 0.0F},
|
||||
look = {0.0F, 0.0F, -1.0F};
|
||||
guLookAt(v, &cam, &up, &look);
|
||||
|
||||
// setup our projection matrix
|
||||
// this creates a perspective matrix with a view angle of 60,
|
||||
// an aspect ratio of 4/3 (i'm not sure if that's the right
|
||||
// way to do it but i just went by what made a square on my screen)
|
||||
// and z near and far distances
|
||||
f32 w = rmode->viWidth;
|
||||
f32 h = rmode->viHeight;
|
||||
guPerspective(p, 60, (f32)w/h, 10.0F, 300.0F);
|
||||
GX_LoadProjectionMtx(p, GX_PERSPECTIVE);
|
||||
|
||||
GXColor Test = { 192, 255, 0, 255 };
|
||||
GX_SetFog(GX_FOG_EXP2, 1, 2, 3, 4, Test);
|
||||
GXFogAdjTbl bum;
|
||||
GX_SetFogRangeAdj(GX_ENABLE, 255, &bum);
|
||||
// setup vertexes
|
||||
draw_init();
|
||||
|
||||
colour1 = CvtRGB (0xff, 0xff, 0xff, 0xff, 0xff, 0xff);
|
||||
// main loop
|
||||
while(1) {
|
||||
|
||||
PAD_ScanPads();
|
||||
|
||||
if (PAD_ButtonsDown(0) & PAD_BUTTON_START) {
|
||||
void (*reload)() = (void(*)())0x90000020;
|
||||
reload();
|
||||
}
|
||||
|
||||
// do this before drawing
|
||||
GX_SetViewport(0,0,rmode->fbWidth,rmode->efbHeight,0,1);
|
||||
GX_InvVtxCache();
|
||||
GX_InvalidateTexAll();
|
||||
GX_SetScissor(640 , 480,680 , 560);
|
||||
GX_SetScissorBoxOffset(-80, -80);
|
||||
|
||||
// draw our cube
|
||||
draw_cube(v);
|
||||
|
||||
GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
|
||||
GX_SetColorUpdate(GX_TRUE);
|
||||
GX_CopyDisp(xfb[curr_fb],GX_TRUE);
|
||||
|
||||
// do this stuff after drawing
|
||||
GX_DrawDone();
|
||||
/*** Draw Bouncing Square ***/
|
||||
if (directionx)
|
||||
startx -= 4;
|
||||
else
|
||||
startx += 4;
|
||||
|
||||
if (directiony)
|
||||
starty -= 2;
|
||||
else
|
||||
starty += 2;
|
||||
|
||||
if (startx >= 576) directionx = 1;
|
||||
|
||||
if (starty >= (rmode->xfbHeight - 64)) directiony = 1;
|
||||
|
||||
if (startx < 0) {
|
||||
startx = 0;
|
||||
directionx = 0;
|
||||
}
|
||||
|
||||
if (starty < 0) {
|
||||
starty = 0;
|
||||
directiony = 0;
|
||||
}
|
||||
|
||||
CP = (starty * 320) + (startx >> 1);
|
||||
for (int rows = 0; rows < 64; rows++) {
|
||||
for (int cols = 0; cols < 32; cols++)
|
||||
xfb[curr_fb][CP + cols] = colour1;
|
||||
|
||||
CP += 320;
|
||||
}
|
||||
VIDEO_SetNextFramebuffer(xfb[curr_fb]);
|
||||
|
||||
if(first_frame) {
|
||||
first_frame = 0;
|
||||
VIDEO_SetBlack(FALSE);
|
||||
}
|
||||
VIDEO_Flush();
|
||||
|
||||
VIDEO_WaitVSync();
|
||||
curr_fb ^= 1;
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
void draw_init() {
|
||||
//---------------------------------------------------------------------------------
|
||||
// setup the vertex descriptor
|
||||
// tells the flipper to expect 8bit indexes for position
|
||||
// and color data. could also be set to direct.
|
||||
GX_ClearVtxDesc();
|
||||
GX_SetVtxDesc(GX_VA_POS, GX_INDEX8);
|
||||
GX_SetVtxDesc(GX_VA_CLR0, GX_INDEX8);
|
||||
|
||||
// setup the vertex attribute table
|
||||
// describes the data
|
||||
// args: vat location 0-7, type of data, data format, size, scale
|
||||
// so for ex. in the first call we are sending position data with
|
||||
// 3 values X,Y,Z of size S16. scale sets the number of fractional
|
||||
// bits for non float data.
|
||||
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
|
||||
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
||||
|
||||
// tells gx where our position and color data is
|
||||
// args: type of data, pointer, array stride
|
||||
GX_SetArray(GX_VA_POS, cube, 3*sizeof(s16));
|
||||
GX_SetArray(GX_VA_CLR0, colors, 4*sizeof(u8));
|
||||
DCFlushRange(cube,sizeof(cube));
|
||||
DCFlushRange(colors,sizeof(colors));
|
||||
|
||||
// no idea...sets to no textures
|
||||
// i don't know anything about textures or lighting yet :|
|
||||
GX_SetNumChans(1);
|
||||
GX_SetNumTexGens(0);
|
||||
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORDNULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
GX_SetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// draws a quad from 4 vertex idx and one color idx
|
||||
//---------------------------------------------------------------------------------
|
||||
void draw_quad(u8 v0, u8 v1, u8 v2, u8 v3, u8 c) {
|
||||
//---------------------------------------------------------------------------------
|
||||
// one 8bit position idx
|
||||
GX_Position1x8(v0);
|
||||
// one 8bit color idx
|
||||
GX_Color1x8(c);
|
||||
GX_Position1x8(v1);
|
||||
GX_Color1x8(c);
|
||||
GX_Position1x8(v2);
|
||||
GX_Color1x8(c);
|
||||
GX_Position1x8(v3);
|
||||
GX_Color1x8(c);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
void draw_cube(Mtx v) {
|
||||
//---------------------------------------------------------------------------------
|
||||
Mtx m; // model matrix.
|
||||
Mtx mv; // modelview matrix.
|
||||
Vector axis = {-1,1,0};
|
||||
static float rotateby = 0;
|
||||
|
||||
rotateby ++;
|
||||
|
||||
// move the cube out in front of us and rotate it
|
||||
guMtxIdentity(m);
|
||||
guMtxRotAxisDeg(m, &axis, rotateby);
|
||||
guMtxTransApply(m, m, -100.0F, -60.0F, -200.0F);
|
||||
guMtxConcat(v,m,mv);
|
||||
// load the modelview matrix into matrix memory
|
||||
GX_LoadPosMtxImm(mv, GX_PNMTX0);
|
||||
|
||||
// drawing begins!
|
||||
// tells the flipper what type of primitive we will be drawing
|
||||
// which descriptor in the VAT to use and the number of vertices
|
||||
// to expect. 24 since we will draw 6 quads with 4 verts each.
|
||||
GX_Begin(GX_QUADS, GX_VTXFMT0, 24);
|
||||
|
||||
draw_quad(0, 3, 2, 1, 0);
|
||||
draw_quad(0, 7, 6, 3, 1);
|
||||
draw_quad(0, 1, 4, 7, 2);
|
||||
draw_quad(1, 2, 5, 4, 3);
|
||||
draw_quad(2, 3, 6, 5, 4);
|
||||
draw_quad(4, 7, 6, 5, 5);
|
||||
|
||||
GX_End();
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
SUBDIRS:= `ls | egrep -v '^(CVS)$$'`
|
||||
|
||||
all:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done;
|
||||
|
||||
clean:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done;
|
||||
|
|
@ -0,0 +1 @@
|
|||
<Project name="template"><MagicFolder excludeFolders="CVS;.svn" filter="*.c;*.cpp;*.h" name="source" path="source\"><File path="template.c"></File></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*.h" name="include" path="include\"></MagicFolder><File path="Makefile"></File></Project>
|
|
@ -0,0 +1 @@
|
|||
<pd><ViewState><e p="template" x="true"></e><e p="template\source" x="true"></e></ViewState></pd>
|
|
@ -0,0 +1,8 @@
|
|||
SUBDIRS:= `ls | egrep -v '^(CVS)$$'`
|
||||
|
||||
all:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done;
|
||||
|
||||
clean:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done;
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||
endif
|
||||
|
||||
include $(DEVKITPPC)/gamecube_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(notdir $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
DATA := data
|
||||
INCLUDES :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
|
||||
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -logc -lm
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# automatically build a list of object files for our project
|
||||
#---------------------------------------------------------------------------------
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
export LD := $(CC)
|
||||
else
|
||||
export LD := $(CXX)
|
||||
endif
|
||||
|
||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
|
||||
$(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD) \
|
||||
-I$(LIBOGC_INC)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
|
||||
-L$(LIBOGC_LIB)
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).dol: $(OUTPUT).elf
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule links in binary data with the .jpg extension
|
||||
#---------------------------------------------------------------------------------
|
||||
%.jpg.o : %.jpg
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
$(bin2o)
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
|
@ -0,0 +1,56 @@
|
|||
#include <aram.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <ogcsys.h>
|
||||
#include <gccore.h>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
static void *xfb = NULL;
|
||||
static GXRModeObj *rmode = NULL;
|
||||
|
||||
void *Initialise();
|
||||
#define NUM_BLOCKS 10
|
||||
u32 aram_blocks[NUM_BLOCKS];
|
||||
u32 start_addr = -1;
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
xfb = Initialise();
|
||||
start_addr = AR_Init(aram_blocks, NUM_BLOCKS);
|
||||
while(1) {
|
||||
PAD_ScanPads();
|
||||
VIDEO_ClearFrameBuffer(rmode, xfb, 0);
|
||||
|
||||
std::cout << "Aram is " << (AR_GetDMAStatus() ? "In Progress" : "Idle") << std::endl;
|
||||
std::cout << "Aram Start is 0x" << std::setbase(16) << start_addr << ", Allocated 0x" << AR_GetSize() << " Of memory" << std::setbase(10) << std::endl;
|
||||
std::cout << "Internal Size is 0x" << std::setbase(16) << AR_GetInternalSize() << std::setbase(10) << std::endl;
|
||||
VIDEO_WaitVSync();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void * Initialise() {
|
||||
|
||||
void *framebuffer;
|
||||
|
||||
VIDEO_Init();
|
||||
PAD_Init();
|
||||
|
||||
rmode = VIDEO_GetPreferredMode(NULL);
|
||||
|
||||
framebuffer = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
|
||||
console_init(framebuffer,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
|
||||
|
||||
VIDEO_Configure(rmode);
|
||||
VIDEO_SetNextFramebuffer(framebuffer);
|
||||
VIDEO_SetBlack(FALSE);
|
||||
VIDEO_Flush();
|
||||
VIDEO_WaitVSync();
|
||||
if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
|
||||
|
||||
return framebuffer;
|
||||
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<Project name="template"><MagicFolder excludeFolders="CVS;.svn" filter="*.c;*.cpp;*.h" name="source" path="source\"><File path="template.c"></File></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*.h" name="include" path="include\"></MagicFolder><File path="Makefile"></File></Project>
|
|
@ -0,0 +1 @@
|
|||
<pd><ViewState><e p="template" x="true"></e><e p="template\source" x="true"></e></ViewState></pd>
|
|
@ -0,0 +1,8 @@
|
|||
SUBDIRS:= `ls | egrep -v '^(CVS)$$'`
|
||||
|
||||
all:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done;
|
||||
|
||||
clean:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
SUBDIRS:= `ls | egrep -v '^(CVS)$$'`
|
||||
|
||||
all:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i || { exit 1;} fi; done;
|
||||
|
||||
clean:
|
||||
@for i in $(SUBDIRS); do if test -e $$i/Makefile ; then $(MAKE) -C $$i clean || { exit 1;} fi; done;
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
#---------------------------------------------------------------------------------
|
||||
# Clear the implicit built in rules
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPPC)),)
|
||||
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
|
||||
endif
|
||||
|
||||
include $(DEVKITPPC)/gamecube_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# TARGET is the name of the output
|
||||
# BUILD is the directory where object files & intermediate files will be placed
|
||||
# SOURCES is a list of directories containing source code
|
||||
# INCLUDES is a list of directories containing extra header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(notdir $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source
|
||||
DATA := data
|
||||
INCLUDES :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE)
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
|
||||
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# any extra libraries we wish to link with the project
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBS := -logc -lm
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS :=
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
# rules for different file extensions
|
||||
#---------------------------------------------------------------------------------
|
||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
|
||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
||||
|
||||
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# automatically build a list of object files for our project
|
||||
#---------------------------------------------------------------------------------
|
||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
||||
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# use CXX for linking C++ projects, CC for standard C
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(CPPFILES)),)
|
||||
export LD := $(CC)
|
||||
else
|
||||
export LD := $(CXX)
|
||||
endif
|
||||
|
||||
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
|
||||
$(sFILES:.s=.o) $(SFILES:.S=.o)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of include paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I$(CURDIR)/$(BUILD) \
|
||||
-I$(LIBOGC_INC)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# build a list of library paths
|
||||
#---------------------------------------------------------------------------------
|
||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
|
||||
-L$(LIBOGC_LIB)
|
||||
|
||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||
.PHONY: $(BUILD) clean
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
$(BUILD):
|
||||
@[ -d $@ ] || mkdir -p $@
|
||||
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo clean ...
|
||||
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
else
|
||||
|
||||
DEPENDS := $(OFILES:.o=.d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# main targets
|
||||
#---------------------------------------------------------------------------------
|
||||
$(OUTPUT).dol: $(OUTPUT).elf
|
||||
$(OUTPUT).elf: $(OFILES)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# This rule links in binary data with the .jpg extension
|
||||
#---------------------------------------------------------------------------------
|
||||
%.jpg.o : %.jpg
|
||||
#---------------------------------------------------------------------------------
|
||||
@echo $(notdir $<)
|
||||
$(bin2o)
|
||||
|
||||
-include $(DEPENDS)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
endif
|
||||
#---------------------------------------------------------------------------------
|
|
@ -0,0 +1,55 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <ogcsys.h>
|
||||
#include <gccore.h>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
static void *xfb = NULL;
|
||||
static GXRModeObj *rmode = NULL;
|
||||
|
||||
void *Initialise();
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
xfb = Initialise();
|
||||
|
||||
while(1) {
|
||||
PAD_ScanPads();
|
||||
VIDEO_ClearFrameBuffer(rmode, xfb, 0);
|
||||
for(int Chan = 0; Chan < 4; Chan++)
|
||||
{
|
||||
std::cout << "Chan " << Chan << std::endl;
|
||||
std::cout << "Status is " << SI_GetStatus(Chan) << std::endl;
|
||||
std::cout << "Type is 0x" << std::setbase(16) << SI_GetType(Chan) << std::setbase(10) << std::endl << std::endl;
|
||||
}
|
||||
|
||||
VIDEO_WaitVSync();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void * Initialise() {
|
||||
|
||||
void *framebuffer;
|
||||
|
||||
VIDEO_Init();
|
||||
PAD_Init();
|
||||
|
||||
rmode = VIDEO_GetPreferredMode(NULL);
|
||||
|
||||
framebuffer = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
|
||||
console_init(framebuffer,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
|
||||
|
||||
VIDEO_Configure(rmode);
|
||||
VIDEO_SetNextFramebuffer(framebuffer);
|
||||
VIDEO_SetBlack(FALSE);
|
||||
VIDEO_Flush();
|
||||
VIDEO_WaitVSync();
|
||||
if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
|
||||
|
||||
return framebuffer;
|
||||
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<Project name="template"><MagicFolder excludeFolders="CVS;.svn" filter="*.c;*.cpp;*.h" name="source" path="source\"><File path="template.c"></File></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*.h" name="include" path="include\"></MagicFolder><File path="Makefile"></File></Project>
|
|
@ -0,0 +1 @@
|
|||
<pd><ViewState><e p="template" x="true"></e><e p="template\source" x="true"></e></ViewState></pd>
|
Loading…
Reference in New Issue