Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
9ae9eb2
started working on a way for ios version to easy transfer of games an…
Jul 26, 2015
31fd226
added web server project and working on a way to call the server from…
Jul 27, 2015
78dc540
more work to integrate web server service with cross platform codebase
Jul 27, 2015
0085410
web server works. upload and download of game saves and roms is worki…
Jul 27, 2015
33b8524
added ios project into repo because of specific changes made to proje…
Jul 27, 2015
9eabe1f
more clean up to allow building of xcode project
Jul 27, 2015
43871b6
ui integration almost complete. wifi checking is complete. text and h…
Jul 27, 2015
5d836ae
IP is broadcasting correctly and when you leave the dialog the server…
Jul 27, 2015
c2d5d5a
fixed issue with server not stopping. everything seems to be working …
Jul 27, 2015
9a421d2
updated minor preprocesser definition and cleaned build
Jul 27, 2015
e7358f9
updated readme markdown
Jul 27, 2015
c3c8a64
device wont sleep now when web server is running on device
Jul 28, 2015
4725ba5
added my custom changes to the project that enables ios devices to ea…
Jul 29, 2015
dac4b2b
changed submodule to point to personal repo. temporarily
Jul 29, 2015
5683b69
updated submodule native
Jul 29, 2015
ca92887
added cmake rules for new sources for ios file web server
Jul 29, 2015
6e706df
project is building. for some reason CMake isnt include GCDWebUploade…
Jul 30, 2015
0a11e55
GCDWebupload bundle is now adding correctly to bundle. all set for pu…
Jul 30, 2015
6d73129
Merge branch 'develop'
Jul 30, 2015
574d39a
ios web server is fully functioning and building with cmake
Jul 30, 2015
dbfdd52
clean up to get the branch ready for merge with master repo
Jul 30, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ gen
libs
obj
build*/

/git-version.cpp

.pspsh.hist
Expand Down
74 changes: 68 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -764,18 +764,69 @@ elseif(IOS)
ios/main.mm
ios/AppDelegate.mm
ios/AppDelegate.h
ios/http/FileWebServer.h
ios/http/FileWebServer.m
ios/http/GCDWebServer/Core/GCDWebServer.h
ios/http/GCDWebServer/Core/GCDWebServer.m
ios/http/GCDWebServer/Core/GCDWebServerConnection.h
ios/http/GCDWebServer/Core/GCDWebServerConnection.m
ios/http/GCDWebServer/Core/GCDWebServerFunctions.h
ios/http/GCDWebServer/Core/GCDWebServerFunctions.m
ios/http/GCDWebServer/Core/GCDWebServerHTTPStatusCodes.h
ios/http/GCDWebServer/Core/GCDWebServerPrivate.h
ios/http/GCDWebServer/Core/GCDWebServerRequest.h
ios/http/GCDWebServer/Core/GCDWebServerRequest.m
ios/http/GCDWebServer/Core/GCDWebServerResponse.h
ios/http/GCDWebServer/Core/GCDWebServerResponse.m
ios/http/GCDWebServer/Requests/GCDWebServerDataRequest.h
ios/http/GCDWebServer/Requests/GCDWebServerDataRequest.m
ios/http/GCDWebServer/Requests/GCDWebServerFileRequest.h
ios/http/GCDWebServer/Requests/GCDWebServerFileRequest.m
ios/http/GCDWebServer/Requests/GCDWebServerMultiPartFormRequest.h
ios/http/GCDWebServer/Requests/GCDWebServerMultiPartFormRequest.m
ios/http/GCDWebServer/Requests/GCDWebServerURLEncodedFormRequest.h
ios/http/GCDWebServer/Requests/GCDWebServerURLEncodedFormRequest.m
ios/http/GCDWebServer/Responses/GCDWebServerDataResponse.h
ios/http/GCDWebServer/Responses/GCDWebServerDataResponse.m
ios/http/GCDWebServer/Responses/GCDWebServerErrorResponse.h
ios/http/GCDWebServer/Responses/GCDWebServerErrorResponse.m
ios/http/GCDWebServer/Responses/GCDWebServerFileResponse.h
ios/http/GCDWebServer/Responses/GCDWebServerFileResponse.m
ios/http/GCDWebServer/Responses/GCDWebServerStreamedResponse.h
ios/http/GCDWebServer/Responses/GCDWebServerStreamedResponse.m
#ios/http/GCDWebUploader/GCDWebUploader.bundle
ios/http/GCDWebUploader/GCDWebUploader.h
ios/http/GCDWebUploader/GCDWebUploader.m
ios/http/Reachability/Reachability.h
ios/http/Reachability/Reachability.m
ios/ViewController.mm
ios/ViewController.h
ios/iOSCoreAudio.cpp
ios/iOSCoreAudio.h
ios/iCade/iCadeReaderView.h
ios/iCade/iCadeReaderView.m
ios/iCade/iCadeState.h)
set(nativeExtraLibs ${nativeExtraLibs} "-framework Foundation -framework AudioToolbox -framework CoreGraphics -framework QuartzCore -framework OpenGLES -framework UIKit -framework GLKit -framework OpenAL")
set(nativeExtraLibs ${nativeExtraLibs} "-framework Foundation -framework AudioToolbox -framework CoreGraphics -framework QuartzCore -framework OpenGLES -framework UIKit -framework GLKit -framework OpenAL -framework CFNetwork -framework MobileCoreServices -framework SystemConfiguration")
if(EXISTS "${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks/GameController.framework")
set(nativeExtraLibs ${nativeExtraLibs} "-weak_framework GameController")
endif()

set_source_files_properties(ios/http/FileWebServer.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/http/GCDWebServer/Core/GCDWebServer.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/http/GCDWebServer/Core/GCDWebServerConnection.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/http/GCDWebServer/Core/GCDWebServerFunctions.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/http/GCDWebServer/Core/GCDWebServerRequest.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/http/GCDWebServer/Core/GCDWebServerResponse.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/http/GCDWebServer/Requests/GCDWebServerDataRequest.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/http/GCDWebServer/Requests/GCDWebServerFileRequest.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/http/GCDWebServer/Requests/GCDWebServerMultiPartFormRequest.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/http/GCDWebServer/Requests/GCDWebServerURLEncodedFormRequest.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/http/GCDWebServer/Responses/GCDWebServerDataResponse.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/http/GCDWebServer/Responses/GCDWebServerErrorResponse.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/http/GCDWebServer/Responses/GCDWebServerFileResponse.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/http/GCDWebServer/Responses/GCDWebServerStreamedResponse.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/http/GCDWebUploader/GCDWebUploader.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/http/Reachability/Reachability.m PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/AppDelegate.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)
set_source_files_properties(ios/ViewController.mm PROPERTIES COMPILE_FLAGS -fobjc-arc)

Expand Down Expand Up @@ -1657,13 +1708,22 @@ if (TargetBin)
file(GLOB_RECURSE SHADER_FILES assets/shaders/*)

if (APPLE AND NOT IOS)
set_source_files_properties(${NativeAssets} PROPERTIES MACOSX_PACKAGE_LOCATION "MacOS/assets")
set_source_files_properties(${FLASH0_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "MacOS/assets/flash0/font")
set_source_files_properties(${LANG_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "MacOS/assets/lang")
set_source_files_properties(${SHADER_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "MacOS/assets/shaders")
set_source_files_properties(${NativeAssets} PROPERTIES MACOSX_PACKAGE_LOCATION "MacOS/assets")
set_source_files_properties(${FLASH0_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "MacOS/assets/flash0/font")
set_source_files_properties(${LANG_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "MacOS/assets/lang")
set_source_files_properties(${SHADER_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "MacOS/assets/shaders")
add_executable(${TargetBin} MACOSX_BUNDLE ${ICON_PATH_ABS} ${NativeAssets} ${SHADER_FILES} ${FLASH0_FILES} ${LANG_FILES} ${NativeAppSource})
endif()

add_executable(${TargetBin} MACOSX_BUNDLE ${ICON_PATH_ABS} ${NativeAssets} ${SHADER_FILES} ${FLASH0_FILES} ${LANG_FILES} ${NativeAppSource})
if (APPLE AND IOS)
file(GLOB WEB_ASSETS ios/http/GCDWebUploader/GCDWebUploader.bundle)
#file(INSTALL ${WEB_ASSETS} DESTINATION GCDWebploader.bundle)
set_source_files_properties(${WEB_ASSETS}
PROPERTIES MACOSX_PACKAGE_LOCATION Resources
)

add_executable(${TargetBin} MACOSX_BUNDLE ${ICON_PATH_ABS} ${NativeAssets} ${SHADER_FILES} ${FLASH0_FILES} ${LANG_FILES} ${NativeAppSource} ${WEB_ASSETS})
endif()
else()
add_executable(${TargetBin} ${NativeAppSource})
endif()
Expand Down Expand Up @@ -1691,6 +1751,8 @@ if(IOS)
set_source_files_properties(${RSRC_XIB_FILES}
PROPERTIES MACOSX_PACKAGE_LOCATION Resources
)


set(APP_DIR_NAME \${TARGET_BUILD_DIR}/\${FULL_PRODUCT_NAME})
add_custom_command(TARGET PPSSPP POST_BUILD
COMMAND tar -c -C . --exclude .DS_Store --exclude .git -H gnu assets | tar -x -C '${APP_DIR_NAME}'
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ For the latest source code, see [our github page](https://github.com/hrydgard/pp

For build instructions and other development tutorials, see the [wiki](https://github.com/hrydgard/ppsspp/wiki).


What's new in 1.1
-------------------
* Easily transfer ROMs and game saves between iOS devices and computers
* Integrated HTTP server that will facilitate moving data to and from the device over local WiFi network
* Submitted a pull request with original repo.


What's new in 1.0.1
-------------------
* Bugfixes like the save state scroll issue, cosmetic issues like overscroll
Expand Down
37 changes: 37 additions & 0 deletions UI/DevScreens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "UI/DevScreens.h"
#include "UI/GameSettingsScreen.h"


#ifdef _WIN32
// Want to avoid including the full header here as it includes d3dx.h
int GetD3DXVersion();
Expand Down Expand Up @@ -299,6 +300,42 @@ const char *GetCompilerABI() {
#endif
}

#if defined(IOS)
void ImportExportFilesScreen::CreateViews() {
using namespace UI;
root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT));

ViewGroup *leftColumn = new AnchorLayout(new LinearLayoutParams(1.0f));
root_->Add(leftColumn);

AddStopServerBack(root_);

TabHolder *tabHolder = new TabHolder(ORIENT_VERTICAL, 225, new AnchorLayoutParams(10, 0, 10, 0, false));

root_->Add(tabHolder);
ViewGroup *deviceSpecsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
LinearLayout *deviceSpecs = new LinearLayout(ORIENT_VERTICAL);
deviceSpecs->SetSpacing(0);
deviceSpecsScroll->Add(deviceSpecs);
tabHolder->AddTab("Information", deviceSpecsScroll);

deviceSpecs->Add(new ItemHeader("Web Server"));

char const* websiteUrl = WebServiceControl(true);
if(websiteUrl == NULL) {
deviceSpecs->Add(new InfoItem("Website", "N/A"));
deviceSpecs->Add(new InfoItem("Your device needs to be connected to a WiFi network", ""));
deviceSpecs->Add(new InfoItem("to continue! Go back and reopen to try again.", ""));
} else {
deviceSpecs->Add(new InfoItem("Website", websiteUrl));
deviceSpecs->Add(new InfoItem("Visit the URL above on your computer to easily", ""));
deviceSpecs->Add(new InfoItem("transfer ROMs and game saves.", ""));
}

}
#endif


void SystemInfoScreen::CreateViews() {
// NOTE: Do not translate this section. It will change a lot and will be impossible to keep up.
I18NCategory *di = GetI18NCategory("Dialog");
Expand Down
9 changes: 9 additions & 0 deletions UI/DevScreens.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include "UI/MiscScreens.h"


class DevMenu : public PopupScreen {
public:
DevMenu() : PopupScreen("Dev Tools") {}
Expand Down Expand Up @@ -79,6 +80,14 @@ class LogLevelScreen : public ListPopupScreen {

};

#if defined(IOS)
class ImportExportFilesScreen : public UIDialogScreenWithBackground {
public:
ImportExportFilesScreen() {}
virtual void CreateViews();
};
#endif

class SystemInfoScreen : public UIDialogScreenWithBackground {
public:
SystemInfoScreen() {}
Expand Down
2 changes: 2 additions & 0 deletions UI/GameScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "Core/Host.h"
#include "Core/Config.h"


GameScreen::GameScreen(const std::string &gamePath) : UIDialogScreenWithGameBackground(gamePath) {
SetBackgroundAudioGame(gamePath);
}
Expand All @@ -62,6 +63,7 @@ void GameScreen::CreateViews() {
ViewGroup *leftColumn = new AnchorLayout(new LinearLayoutParams(1.0f));
root_->Add(leftColumn);


leftColumn->Add(new Choice(di->T("Back"), "", false, new AnchorLayoutParams(150, WRAP_CONTENT, 10, NONE, NONE, 10)))->OnClick.Handle(this, &GameScreen::OnSwitchBack);
if (info) {
texvGameIcon_ = leftColumn->Add(new Thin3DTextureView(0, IS_DEFAULT, new AnchorLayoutParams(144 * 2, 80 * 2, 10, 10, NONE, NONE)));
Expand Down
12 changes: 12 additions & 0 deletions UI/GameSettingsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,11 @@ void GameSettingsScreen::CreateViews() {
tools->Add(new Choice(dev->T("System Information")))->OnClick.Handle(this, &GameSettingsScreen::OnSysInfo);
tools->Add(new Choice(sy->T("Developer Tools")))->OnClick.Handle(this, &GameSettingsScreen::OnDeveloperTools);

#if defined(IOS)
tools->Add(new ItemHeader(sy->T("iOS Actions")));
tools->Add(new Choice(dev->T("Import/Export ROMs and Game Saves")))->OnClick.Handle(this, &GameSettingsScreen::OnImportExportFiles);
#endif

// System
ViewGroup *systemSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
LinearLayout *systemSettings = new LinearLayout(ORIENT_VERTICAL);
Expand Down Expand Up @@ -985,6 +990,13 @@ UI::EventReturn GameSettingsScreen::OnSysInfo(UI::EventParams &e) {
return UI::EVENT_DONE;
}

#if defined(IOS)
UI::EventReturn GameSettingsScreen::OnImportExportFiles(UI::EventParams &e) {
screenManager()->push(new ImportExportFilesScreen());
return UI::EVENT_DONE;
}
#endif

void DeveloperToolsScreen::CreateViews() {
using namespace UI;
root_ = new ScrollView(ORIENT_VERTICAL);
Expand Down
8 changes: 6 additions & 2 deletions UI/GameSettingsScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,12 @@ class GameSettingsScreen : public UIDialogScreenWithGameBackground {
UI::EventReturn OnAudioBackend(UI::EventParams &e);

UI::EventReturn OnSavedataManager(UI::EventParams &e);
UI::EventReturn OnSysInfo(UI::EventParams &e);

UI::EventReturn OnSysInfo(UI::EventParams &e);

#if defined(IOS)
UI::EventReturn OnImportExportFiles(UI::EventParams &e);
#endif

// Temporaries to convert bools to int settings
bool cap60FPS_;
int iAlternateSpeedPercent_;
Expand Down
8 changes: 8 additions & 0 deletions UI/MiscScreens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ void UIDialogScreenWithBackground::AddStandardBack(UI::ViewGroup *parent) {
parent->Add(new Choice(di->T("Back"), "", false, new AnchorLayoutParams(150, 64, 10, NONE, NONE, 10)))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
}

#if defined(IOS)
void UIDialogScreenWithBackground::AddStopServerBack(UI::ViewGroup *parent) {
using namespace UI;
I18NCategory *di = GetI18NCategory("Dialog");
parent->Add(new Choice(di->T("Back"), "", false, new AnchorLayoutParams(150, 64, 10, NONE, NONE, 10)))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBackServer);
}
#endif

void UIDialogScreenWithBackground::sendMessage(const char *message, const char *value) {
HandleCommonMessages(message, value, screenManager());
I18NCategory *dev = GetI18NCategory("Developer");
Expand Down
4 changes: 4 additions & 0 deletions UI/MiscScreens.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ class UIDialogScreenWithBackground : public UIDialogScreen {
virtual UI::EventReturn OnLanguageChange(UI::EventParams &e);

void AddStandardBack(UI::ViewGroup *parent);

#if defined(IOS)
void AddStopServerBack(UI::ViewGroup *parent);
#endif
};

class UIDialogScreenWithGameBackground : public UIDialogScreenWithBackground {
Expand Down
1 change: 1 addition & 0 deletions ios/PPSSPP-Prefix.pch
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@

#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif
10 changes: 10 additions & 0 deletions ios/ViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,18 @@
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1
#import <GameController/GameController.h>
#endif

#import <string>
#import "iCade/iCadeReaderView.h"

#import "ios/http/FileWebServer.h"


FileWebServer *fileWebServer;

@interface ViewController : GLKViewController <iCadeEventDelegate>

@end


void bindDefaultFBO();
31 changes: 30 additions & 1 deletion ios/ViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include "Core/Config.h"
#include "gfx_es2/fbo.h"



#define IS_IPAD() ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad)
#define IS_IPHONE() ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone)

Expand Down Expand Up @@ -583,9 +585,36 @@ - (void)setupController:(GCController *)controller

@end

char const* WebServiceControl(bool init) {

if(init) {
// start the web service
[UIApplication sharedApplication].idleTimerDisabled = YES;

fileWebServer = [[FileWebServer alloc] init];
NSString *host = [fileWebServer startServer];
return [host UTF8String];

} else {
// stop the web service
[UIApplication sharedApplication].idleTimerDisabled = NO;

if(fileWebServer != NULL) {
[fileWebServer stopServer];
fileWebServer = NULL;
}
}

return NULL;
}


void LaunchBrowser(char const* url)
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithCString:url encoding:NSStringEncodingConversionAllowLossy]]];
NSString *str = [NSString stringWithCString:url encoding:NSStringEncodingConversionAllowLossy];
NSLog(@"URL: %@", str);

[[UIApplication sharedApplication] openURL:[NSURL URLWithString: str]];
}

void bindDefaultFBO()
Expand Down
35 changes: 35 additions & 0 deletions ios/http/FileWebServer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// WebServer.h
// PPSSPP
//
// Created by Daniel Gillespie on 7/25/15.
//

#import <Foundation/Foundation.h>

// Networking (GET IP)
#include <ifaddrs.h>
#include <arpa/inet.h>


#import "ios/http/Reachability/Reachability.h"


// Web Server
#import "ios/http/GCDWebUploader/GCDWebUploader.h"



GCDWebUploader *webServer;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's incorrect for this to be in the header. Any and all files that import this header will have their own copy instead of using a single shared copy. Did you mean to have extern GCDWebUploader *webServer; here, with GCDWebUploader *webServer; in the .m file?


@interface FileWebServer : NSObject <GCDWebUploaderDelegate>

// prototypes
-(id)init;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to have instancetype instead of id here for type safety and better IDE autocompletion.

-(NSString*) getDocumentDirectory;
- (NSString *)getIPAddress;
-(NSString*) startServer;
-(void) stopServer;

@end

Loading