mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-18 00:07:23 +00:00
(360) Rudimentary working filebrowser - hardcoded to game://roms/
path right now
This commit is contained in:
parent
e85471a239
commit
02996fbe2e
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include <Xtl.h>
|
||||
#include "fileio.h"
|
||||
#include "file_browser.h"
|
||||
#include "../general.h"
|
||||
#include "../file.h"
|
||||
|
||||
@ -89,7 +89,7 @@ void filebrowser_parse_directory(filebrowser_t * filebrowser, const char * path,
|
||||
found_dir = true;
|
||||
|
||||
filebrowser->cur[filebrowser->file_count].d_type = found_dir ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_NORMAL;
|
||||
strlcat(filebrowser->cur[filebrowser->file_count].d_nam, ffd.cFileName, PATH_MAX);
|
||||
sprintf(filebrowser->cur[filebrowser->file_count].d_name, ffd.cFileName);
|
||||
|
||||
filebrowser->file_count++;
|
||||
}while (FindNextFile(hFind, &ffd) != 0 && (filebrowser->file_count + 1) < FATX_MAX_FILE_LIMIT);
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
typedef struct {
|
||||
unsigned d_type;
|
||||
char d_nam[XCONTENT_MAX_FILENAME_LENGTH];
|
||||
CHAR d_name[MAX_PATH];
|
||||
} DirectoryEntry;
|
||||
|
||||
typedef struct {
|
||||
|
47
360/main.c
47
360/main.c
@ -23,6 +23,7 @@
|
||||
#include <xbdm.h>
|
||||
#include "menu.h"
|
||||
#include "xdk360_video.h"
|
||||
#include "../console/main_wrap.h"
|
||||
#include "../general.h"
|
||||
#include "shared.h"
|
||||
|
||||
@ -121,22 +122,6 @@ static int Mount( int Device, char* MountPoint )
|
||||
return DriveMounted(MountPoint);
|
||||
}
|
||||
|
||||
|
||||
static void MountAll()
|
||||
{
|
||||
memset(&Mounted,0,20);
|
||||
|
||||
Mounted[DEVICE_USB0] = Mount(DEVICE_USB0,"Usb0:");
|
||||
Mounted[DEVICE_USB1] = Mount(DEVICE_USB1,"Usb1:");
|
||||
Mounted[DEVICE_USB2] = Mount(DEVICE_USB2,"Usb2:");
|
||||
Mounted[DEVICE_HARDISK0_PART1] = Mount(DEVICE_HARDISK0_PART1,"Hdd1:");
|
||||
Mounted[DEVICE_HARDISK0_SYSPART] = Mount(DEVICE_HARDISK0_SYSPART,"HddX:");
|
||||
Mounted[DEVICE_MEMORY_UNIT0] = Mount(DEVICE_MEMORY_UNIT0,"Memunit0:");
|
||||
Mounted[DEVICE_MEMORY_UNIT1] = Mount(DEVICE_MEMORY_UNIT1,"Memunit1:");
|
||||
Mounted[DEVICE_MEMORY_ONBOARD] = Mount(DEVICE_MEMORY_ONBOARD,"OnBoardMU:");
|
||||
Mounted[DEVICE_CDROM0] = Mount(DEVICE_CDROM0,"Dvd:");
|
||||
}
|
||||
|
||||
static void set_default_settings(void)
|
||||
{
|
||||
//g_settings
|
||||
@ -153,13 +138,23 @@ static void get_environment_settings (void)
|
||||
//in a different way
|
||||
//DmMapDevkitDrive();
|
||||
|
||||
MountAll();
|
||||
memset(&Mounted, 0, 20);
|
||||
|
||||
Mounted[DEVICE_USB0] = Mount(DEVICE_USB0,"Usb0:");
|
||||
Mounted[DEVICE_USB1] = Mount(DEVICE_USB1,"Usb1:");
|
||||
Mounted[DEVICE_USB2] = Mount(DEVICE_USB2,"Usb2:");
|
||||
Mounted[DEVICE_HARDISK0_PART1] = Mount(DEVICE_HARDISK0_PART1,"Hdd1:");
|
||||
Mounted[DEVICE_HARDISK0_SYSPART] = Mount(DEVICE_HARDISK0_SYSPART,"HddX:");
|
||||
Mounted[DEVICE_MEMORY_UNIT0] = Mount(DEVICE_MEMORY_UNIT0,"Memunit0:");
|
||||
Mounted[DEVICE_MEMORY_UNIT1] = Mount(DEVICE_MEMORY_UNIT1,"Memunit1:");
|
||||
Mounted[DEVICE_MEMORY_ONBOARD] = Mount(DEVICE_MEMORY_ONBOARD,"OnBoardMU:");
|
||||
Mounted[DEVICE_CDROM0] = Mount(DEVICE_CDROM0,"Dvd:");
|
||||
|
||||
BOOL result_filecache = XSetFileCacheSize(0x100000);
|
||||
|
||||
if(result_filecache != TRUE)
|
||||
{
|
||||
SSNES_ERR("Couldn't hange number of bytes reserved for file system cache.\n");
|
||||
SSNES_ERR("Couldn't change number of bytes reserved for file system cache.\n");
|
||||
}
|
||||
DWORD result = XMountUtilityDriveEx(XMOUNTUTILITYDRIVE_FORMAT0,8192, 0);
|
||||
|
||||
@ -223,15 +218,15 @@ begin_loop:
|
||||
{
|
||||
if(g_emulator_initialized)
|
||||
ssnes_main_deinit();
|
||||
|
||||
struct ssnes_main_wrap args;
|
||||
args.verbose = g_extern.verbose;
|
||||
args.sram_path = NULL;
|
||||
args.state_path = NULL;
|
||||
args.config_path = NULL;
|
||||
args.rom_path = g_console.rom_path;
|
||||
|
||||
char arg1[] = "ssnes";
|
||||
char arg2[] = "d:\\roms\\mario.sfc";
|
||||
char arg3[] = "-v";
|
||||
char arg4[] = "-c";
|
||||
char arg5[] = "d:\\ssnes.cfg";
|
||||
char *argv_[] = { arg1, arg2, arg3, arg4, arg5, NULL };
|
||||
int argc_ = sizeof(argv_) / sizeof(argv_[0]) - 1;
|
||||
int init_ret = ssnes_main_init(argc_, argv_);
|
||||
int init_ret = ssnes_main_init_wrap(&args);
|
||||
g_emulator_initialized = 1;
|
||||
init_ssnes = 0;
|
||||
}
|
||||
|
76
360/media/ssnes_filebrowser.xui
Normal file
76
360/media/ssnes_filebrowser.xui
Normal file
@ -0,0 +1,76 @@
|
||||
<XuiCanvas version="000c">
|
||||
<Properties>
|
||||
<Width>1280.000000</Width>
|
||||
<Height>720.000000</Height>
|
||||
</Properties>
|
||||
<XuiScene>
|
||||
<Properties>
|
||||
<Id>XuiSceneFileBrowser</Id>
|
||||
<Width>410.000000</Width>
|
||||
<Height>251.000000</Height>
|
||||
<Position>439.013489,260.875977,0.000000</Position>
|
||||
<ClassOverride>SSNESFileBrowser</ClassOverride>
|
||||
</Properties>
|
||||
<XuiText>
|
||||
<Properties>
|
||||
<Id>XuiTxtTitle</Id>
|
||||
<Width>111.840027</Width>
|
||||
<Height>40.000000</Height>
|
||||
<Position>28.893612,12.519989,0.000000</Position>
|
||||
<Text>Filebrowser</Text>
|
||||
<TextColor>0xff0f0f0f</TextColor>
|
||||
<DropShadowColor>0x800f0f0f</DropShadowColor>
|
||||
<Font>Arial Unicode MS</Font>
|
||||
<TextStyle>21</TextStyle>
|
||||
</Properties>
|
||||
</XuiText>
|
||||
<XuiCommonList>
|
||||
<Properties>
|
||||
<Id>XuiRomList</Id>
|
||||
<Width>362.400024</Width>
|
||||
<Height>118.960022</Height>
|
||||
<Position>22.799980,81.600006,0.000000</Position>
|
||||
</Properties>
|
||||
<XuiListItem>
|
||||
<Properties>
|
||||
<Id>control_ListItem</Id>
|
||||
<Width>226.000000</Width>
|
||||
<Height>45.000000</Height>
|
||||
<Position>7.000000,22.000000,0.000000</Position>
|
||||
<Anchor>5</Anchor>
|
||||
<Show>false</Show>
|
||||
<Visual>XuiButton</Visual>
|
||||
<InterItemSpacing>0.000000,10.000000,0.000000</InterItemSpacing>
|
||||
</Properties>
|
||||
</XuiListItem>
|
||||
</XuiCommonList>
|
||||
<XuiBackButton>
|
||||
<Properties>
|
||||
<Id>XuiBackButton1</Id>
|
||||
<Width>219.000000</Width>
|
||||
<Height>36.000000</Height>
|
||||
<Position>168.679993,202.600006,0.000000</Position>
|
||||
<PressKey>22593</PressKey>
|
||||
</Properties>
|
||||
</XuiBackButton>
|
||||
<XuiText>
|
||||
<Properties>
|
||||
<Id>XuiTxtRomPath</Id>
|
||||
<Width>166.559998</Width>
|
||||
<Height>28.480011</Height>
|
||||
<Position>96.000000,42.480011,0.000000</Position>
|
||||
<TextColor>0xff0f0f0f</TextColor>
|
||||
<DropShadowColor>0x800f0f0f</DropShadowColor>
|
||||
</Properties>
|
||||
</XuiText>
|
||||
<XuiLabel>
|
||||
<Properties>
|
||||
<Id>XuiLblPath</Id>
|
||||
<Width>72.880005</Width>
|
||||
<Height>28.000000</Height>
|
||||
<Position>26.000000,43.000000,0.000000</Position>
|
||||
<Text>PATH:</Text>
|
||||
</Properties>
|
||||
</XuiLabel>
|
||||
</XuiScene>
|
||||
</XuiCanvas>
|
42
360/menu.cpp
42
360/menu.cpp
@ -33,6 +33,7 @@ HXUIOBJ hMainScene;
|
||||
HXUIOBJ hFileBrowser;
|
||||
HXUIOBJ hSSNESSettings;
|
||||
filebrowser_t browser;
|
||||
char strbuffer[1024];
|
||||
|
||||
/* Register custom classes */
|
||||
HRESULT CSSNES::RegisterXuiClasses (void)
|
||||
@ -40,7 +41,6 @@ HRESULT CSSNES::RegisterXuiClasses (void)
|
||||
CSSNESMain::Register();
|
||||
CSSNESFileBrowser::Register();
|
||||
CSSNESSettings::Register();
|
||||
filebrowser_parse_directory(&browser, "game:\\roms\\", ssnes_console_get_rom_ext());
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@ -56,6 +56,24 @@ HRESULT CSSNES::UnregisterXuiClasses (void)
|
||||
HRESULT CSSNESFileBrowser::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
|
||||
{
|
||||
GetChildById(L"XuiRomList", &m_romlist);
|
||||
GetChildById(L"XuiTxtRomPath", &m_rompathtitle);
|
||||
|
||||
filebrowser_parse_directory(&browser, "game:\\roms\\", ssnes_console_get_rom_ext());
|
||||
|
||||
DWORD dwNum_rompath = MultiByteToWideChar(CP_ACP, 0, "game:\\roms\\", -1, NULL, 0);
|
||||
wchar_t * rompath_name = new wchar_t[dwNum_rompath];
|
||||
MultiByteToWideChar(CP_ACP, 0, "game:\\roms\\", -1, rompath_name, dwNum_rompath);
|
||||
m_rompathtitle.SetText(rompath_name);
|
||||
|
||||
m_romlist.InsertItems(0, browser.file_count);
|
||||
for(unsigned i = 0; i < browser.file_count; i++)
|
||||
{
|
||||
DWORD dwNum = MultiByteToWideChar(CP_ACP, 0, browser.cur[i].d_name, -1, NULL, 0);
|
||||
wchar_t * entry_name = new wchar_t[dwNum];
|
||||
MultiByteToWideChar(CP_ACP, 0, browser.cur[i].d_name, -1, entry_name, dwNum);
|
||||
m_romlist.SetText(i, entry_name);
|
||||
delete []entry_name;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@ -93,6 +111,17 @@ HRESULT CSSNESMain::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
|
||||
|
||||
HRESULT CSSNESFileBrowser::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled )
|
||||
{
|
||||
int index = m_romlist.GetCurSel();
|
||||
if(browser.cur[index].d_type != FILE_ATTRIBUTE_DIRECTORY)
|
||||
{
|
||||
memset(strbuffer, 0, sizeof(strbuffer));
|
||||
wcstombs(strbuffer, (const wchar_t *)m_romlist.GetText(index), sizeof(strbuffer));
|
||||
sprintf(g_console.rom_path, "game:\\roms\\%s", strbuffer);
|
||||
g_console.menu_enable = false;
|
||||
g_console.mode_switch = MODE_EMULATION;
|
||||
init_ssnes = 1;
|
||||
}
|
||||
|
||||
bHandled = TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
@ -125,9 +154,14 @@ HRESULT CSSNESMain::OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled )
|
||||
|
||||
if ( hObjPressed == m_filebrowser )
|
||||
{
|
||||
g_console.menu_enable = false;
|
||||
g_console.mode_switch = MODE_EMULATION;
|
||||
init_ssnes = 1;
|
||||
hr = XuiSceneCreate(L"file://game:/media/", L"ssnes_filebrowser.xur", NULL, &hFileBrowser);
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
SSNES_ERR("Failed to load scene.\n");
|
||||
}
|
||||
|
||||
NavigateForward(hFileBrowser);
|
||||
}
|
||||
else if ( hObjPressed == m_settings )
|
||||
{
|
||||
|
@ -37,6 +37,7 @@ class CSSNESFileBrowser: public CXuiSceneImpl
|
||||
{
|
||||
protected:
|
||||
CXuiList m_romlist;
|
||||
CXuiTextElement m_rompathtitle;
|
||||
public:
|
||||
HRESULT OnInit( XUIMessageInit* pInitData, BOOL& bHandled );
|
||||
HRESULT OnNotifyPress( HXUIOBJ hObjPressed, BOOL& bHandled );
|
||||
|
@ -19,7 +19,6 @@
|
||||
#define MAIN_WRAP_H__
|
||||
|
||||
#ifdef _MSC_VER
|
||||
unsigned char bool;
|
||||
#else
|
||||
#include <stdbool.h>
|
||||
#endif
|
||||
|
@ -278,6 +278,7 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Xbox 360'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\conf\config_file.c" />
|
||||
<ClCompile Include="..\..\console\main_wrap.c" />
|
||||
<ClCompile Include="..\..\console\rom_ext.c" />
|
||||
<ClCompile Include="..\..\driver.c" />
|
||||
<ClCompile Include="..\..\dynamic.c" />
|
||||
@ -408,7 +409,24 @@
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_LTCG|Xbox 360'">$(OutDir)media\ssnes_settings.xur;</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="..\..\360\media\ssnes_filebrowser.xui">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Xbox 360'">xui2bin /D /NOLOGO "%(RelativeDir)ssnes_filebrowser.xui" "$(OutDir)media\ssnes_filebrowser.xur"</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Xbox 360'">$(OutDir)media\ssnes_filebrowser.xur;</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='CodeAnalysis|Xbox 360'">$(OutDir)media\ssnes_filebrowser.xur;</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">$(OutDir)media\ssnes_filebrowser.xur;</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Profile|Xbox 360'">$(OutDir)media\ssnes_filebrowser.xur;</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Profile_FastCap|Xbox 360'">$(OutDir)media\ssnes_filebrowser.xur;</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_LTCG|Xbox 360'">$(OutDir)media\ssnes_filebrowser.xur;</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='CodeAnalysis|Xbox 360'">xui2bin /D /NOLOGO "%(RelativeDir)ssnes_filebrowser.xui" "$(OutDir)media\ssnes_filebrowser.xur"</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Xbox 360'">xui2bin /D /NOLOGO "%(RelativeDir)ssnes_filebrowser.xui" "$(OutDir)media\ssnes_filebrowser.xur"</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Profile|Xbox 360'">xui2bin /D /NOLOGO "%(RelativeDir)ssnes_filebrowser.xui" "$(OutDir)media\ssnes_filebrowser.xur"</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Profile_FastCap|Xbox 360'">xui2bin /D /NOLOGO "%(RelativeDir)ssnes_filebrowser.xui" "$(OutDir)media\ssnes_filebrowser.xur"</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release_LTCG|Xbox 360'">xui2bin /D /NOLOGO "%(RelativeDir)ssnes_filebrowser.xui" "$(OutDir)media\ssnes_filebrowser.xur"</Command>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
@ -128,6 +128,9 @@
|
||||
<ClCompile Include="..\..\360\file_browser.c">
|
||||
<Filter>Source Files\360</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\console\main_wrap.c">
|
||||
<Filter>Source Files\console</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\ups.h">
|
||||
@ -234,5 +237,8 @@
|
||||
<CustomBuild Include="..\..\360\media\ssnes_settings.xui">
|
||||
<Filter>Source Files\media</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="..\..\360\media\ssnes_filebrowser.xui">
|
||||
<Filter>Source Files\media</Filter>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user