Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add iOS version of Dolphin Old #3881

Closed
wants to merge 25 commits into from
Closed

Add iOS version of Dolphin Old #3881

wants to merge 25 commits into from

Conversation

WilliamLCobb
Copy link

@WilliamLCobb WilliamLCobb commented Jun 5, 2016

The pull request has moved here: #3885

Most of the changes are pretty straightforward.

Added iOS directory in Source.
Added new IOS definition when building for iOS
Added build steps for in readme.

Cmake will generate an Xcode project in the build directory and copy in the Xcode project and workspace from the iOS directory. The workspace will combine these two projects, allowing full compatibility with future cmake and source changes while also giving control of all of the build settings for iOS. Since iOS is not inherently supported by cmake, this would have been very hard if not impossible without this step. The iOS app can be built in the Xcode GUI and also built from the command line.

Only one commit has a chance of affecting other builds: "IOS macro workaround" (0a22fb7). IOS was being used as a variable in a struct in Network.cpp and Network.h. Since I was using this as a definition for building iOS, i changed all instances of this variable to _IOS. This probably needs to be changed to something else, I just wasn't sure what


This change is Reviewable

The contents of this directory will be copied into the build directory
post build.

These files make up the user interface and also handle host messages
IGL uses a GLKView as it’s main window.
iOS needs the prepare function for IGL to know when to prepare it’s
frame buffer to be drawn in to.
Since iOS does not have a default frame buffer, we must bind
GL_FRAMEBUFFER. This frame buffer is tied to the GLKView used in IGL
Since iOS doe not have <asm/hwcap.h> or <sys/auxv.h>, we let hardware
information remain uninitialized. This will need to be fixed
Since IOS is now used a definition, we cannot use IOS as a variable. We
could undefine IOS and redefine it, but this seemed more logical
iOS does not have kAudioUnitSubType_DefaultOutput. Use
kAudioUnitSubType_GenericOutput
For std::array we needed <array>.
For sys_cache_control we needed <libkern/OSCacheControl.h>
On iOS pages will be mapped ANON and PRIVATE.

Also map the memory arenas as if we are on a 32 bit machine due to lack
of virtual memory
Since I was unable to fix MachineContext.h for iOS, I added empty
implementations for iOS until a fix can be added
Use default apple context until fixed for iOS
m_flush_trigger.WaitFor() causes Dolphin to crash on iOS around every
other time a game is loaded. Remove for now and discover why this
causes a crash later
Added specific CMake configurations for IOS
iOS does not have <sys/disk.h>. These functions won’t be used to
setting DKIOCGETBLOCKCOUNT and DKIOCGETBLOCKSIZE to arbitrary values
serves as a workaround.
Updated readme to include system requirements and build steps for iOS
This is a simple game that will be included in the Roms directory for
iOS builds
@Helios747
Copy link
Contributor

@dolphin-emu-bot rebuild

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>

This comment was marked as off-topic.

@@ -11,7 +11,7 @@
enum MACConsumer
{
BBA = 0,
IOS = 1
_IOS = 1

This comment was marked as off-topic.

@JosJuice
Copy link
Member

JosJuice commented Jun 5, 2016

Could you call the define something other than IOS? It's easy to think it refers to IOS (the software running on the Wii's ARM CPU) rather than iOS, and it also causes that problem with the IOS enum value that you mentioned. Would APPLE_IOS work?

The extraction/decompression code needs to be removed completely from the PR, not committed and then reverted.

@WilliamLCobb
Copy link
Author

WilliamLCobb commented Jun 5, 2016

Yea APPLE_IOS is fine.

I can remove them or I can submit a new pull request when all of the changes have been made. The decompression libraries have been removed from my fork

@@ -6,7 +6,9 @@

#include "Common/GL/GLInterfaceBase.h"

#if defined(__APPLE__)
#if defined IOS
#include "Common/GL/GLInterface/IGL.h"

This comment was marked as off-topic.

This comment was marked as off-topic.

@degasus
Copy link
Member

degasus commented Jun 5, 2016

Reviewed 24 of 301 files at r1.
Review status: 23 of 246 files reviewed at latest revision, 20 unresolved discussions, some commit checks failed.


Readme.md, line 110 [r2] (raw file):

1. `mkdir Build`
2. `cd Build`
3. `cmake .. -G Xcode -DENABLE_PCH=false -DCMAKE_TOOLCHAIN_FILE=../Source/iOS/ios.toolchain.cmake`

-DENABLE_PCH should be enforced by the cmake file is required.


Externals/SOIL/SOIL.c, line 25 [r2] (raw file):

      #include <GL/gl.h>
  #endif
#elif ((defined(__APPLE__) || defined(__APPLE_CC__)) && !IOS)

What do you think about defininf APPLE on IOS?


Source/Core/Common/Arm64Emitter.cpp, line 15 [r2] (raw file):

#if IOS
    #include <array>

no need to hide array within IOS. It's either needed for all, or non.


Source/Core/Common/ArmCPUDetect.cpp, line 66 [r2] (raw file):

  strncpy(cpu_string, GetCPUString().c_str(), sizeof(cpu_string));
#if !IOS
  unsigned long hwcaps = getauxval(AT_HWCAP);

I think we should try to support this.


Source/Core/Common/CDUtils.cpp, line 73 [r2] (raw file):

{
    std::vector<std::string> drives;
    return drives;

tab vs space
return {};


Source/Core/Common/CMakeLists.txt, line 74 [r2] (raw file):

  GL/GLInterface/GLInterface.cpp)

if(USE_EGL AND NOT IOS)

Just configure USE_EGL=False within cmake


Source/Core/Common/MemArena.cpp, line 105 [r2] (raw file):

    int flags;
#if IOS
    flags = MAP_ANON | MAP_PRIVATE | ((base == nullptr) ? 0 : MAP_FIXED);

maybe a comment why you've choosen this flags


Source/Core/Common/Network.h, line 11 [r2] (raw file):

#include "Common/CommonTypes.h"

enum MACConsumer

Will an enum class help here?


Source/Core/Common/GL/GLInterface/GLInterface.cpp, line 9 [r2] (raw file):

#include "Common/GL/GLInterfaceBase.h"

#if defined IOS

defined(IOS)


Source/Core/Common/GL/GLInterface/GLInterface.cpp, line 31 [r2] (raw file):

std::unique_ptr<cInterfaceBase> HostGL_CreateGLInterface()
{
    #if defined IOS

spaces vs tab


Source/Core/Common/GL/GLInterface/IGL.h, line 26 [r2] (raw file):

  virtual void ShutdownPlatform() {}

public:

please add public first, then protected, then private


Source/Core/Common/GL/GLInterface/IGL.mm, line 19 [r2] (raw file):

EAGLContext *context;

member variables instead of static please.


Source/Core/Common/GL/GLInterface/IGL.mm, line 53 [r2] (raw file):

    //eaglLayer.drawableProperties = @{kEAGLDrawablePropertyRetainedBacking : @(YES)};

    s_backbuffer_width = glkView.frame.size.width * 2;

why times 2?


Source/Core/Common/Logging/ConsoleListeneriOS.cpp, line 16 [r2] (raw file):

}

void ConsoleListener::Log(LogTypes::LOG_LEVELS level, const char* text)

I wouldn't call this "ios", more like a generic one. If there isn't one (I haven't checked), please just rename this one to "Generic"


Source/Core/Core/PowerPC/JitArm64/JitArm64_BackPatch.cpp, line 20 [r2] (raw file):

using namespace Arm64Gen;

#if !IOS

Did this functions fail to compile, or just fail at execution? I'd like to see fastmem at some point :/


Source/Core/InputCommon/CMakeLists.txt, line 16 [r2] (raw file):

              ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp)
elseif(IOS)
  add_definitions(-DCIFACE_USE_IOS)

Please move this to ControllerInterface.h


Source/Core/InputCommon/CMakeLists.txt, line 18 [r2] (raw file):

  add_definitions(-DCIFACE_USE_IOS)
  set(SRCS ${SRCS}
              ControllerInterface/iOS/iOS.mm

spaces vs tab


Source/Core/VideoBackends/OGL/PostProcessing.cpp, line 52 [r2] (raw file):

    GLint defaultFBO;
    glGetIntegerv(0x8CA6, &defaultFBO);
    glBindFramebuffer(GL_DRAW_FRAMEBUFFER, defaultFBO);

GLInterface->GetDefaultFramebuffer() ?


Source/Core/VideoBackends/OGL/Render.cpp, line 1340 [r2] (raw file):

          // Tell the OSD Menu about the current internal resolution
          OSDInternalW = xfbSource->sourceRc.GetWidth(); OSDInternalH = xfbSource->sourceRc.GetHeight();
            GLInterface->Prepare();

Maybe within BlitScreen?


Comments from Reviewable

@JosJuice
Copy link
Member

JosJuice commented Jun 5, 2016

@WilliamLCobb It is possible to close the PR on your own. Or, you could force push the new version to this PR's branch, avoiding the need for a second PR.

@lioncash
Copy link
Member

lioncash commented Jun 5, 2016

Review status: 23 of 246 files reviewed at latest revision, 46 unresolved discussions, some commit checks failed.


Source/Core/Common/GL/GLInterface/IGL.mm, line 25 [r3] (raw file):

void cInterfaceIGL::Swap()
{
    //NSLog(@"Frame: %d", framenum++);

Please don't leave commented code all over the place.


Source/Core/Common/GL/GLInterface/IGL.mm, line 30 [r3] (raw file):

void cInterfaceIGL::SwapInterval(int Interval)
{

Unnecessary whitespace (and in other places)


Source/Core/InputCommon/ControllerInterface/iOS/iOS.h, line 1 [r3] (raw file):

// Copyright 2008 Dolphin Emulator Project

2016


Source/Core/InputCommon/ControllerInterface/iOS/iOS.h, line 12 [r3] (raw file):

namespace ciface
{
    namespace iOS

We don't put newlines for individual namespaces.


Source/Core/InputCommon/ControllerInterface/iOS/iOS.h, line 15 [r3] (raw file):

    {

    void Init( std::vector<Core::Device*>& devices );

Don't put spaces around parameters


Source/Core/InputCommon/ControllerInterface/iOS/iOS.mm, line 1 [r3] (raw file):

// Copyright 2013 Dolphin Emulator Project

2016


Source/Core/InputCommon/ControllerInterface/iOS/iOS.mm, line 16 [r3] (raw file):

{

void Init( std::vector<Core::Device*>& devices )

No spaces around parameters


Source/Core/InputCommon/ControllerInterface/iOS/iOS.mm, line 175 [r3] (raw file):

{
  std::ostringstream ss;
  ss << "Button " << (int)_index;

static_cast


Source/Core/InputCommon/ControllerInterface/iOS/iOS.mm, line 186 [r3] (raw file):

{
  std::ostringstream ss;
  ss << "Axis " << (int)_index;

static_cast


Source/Core/InputCommon/ControllerInterface/iOS/iOSButtonManager.cpp, line 1 [r3] (raw file):

// Copyright 2013 Dolphin Emulator Project

2016


Source/iOS/DolphiniOS/AppDelegate.m, line 20 [r3] (raw file):

#import "SCLAlertView.h"
#import "ZAActivityBar.h"

This file could do with some spacing cleanup.


Source/iOS/DolphiniOS/EmulatorViewController.mm, line 9 [r3] (raw file):

//

#import "EmulatorViewController.h"

These paths should be relative like the others


Source/iOS/DolphiniOS/GameTableView.h, line 6 [r3] (raw file):

//
//  Created by Will Cobb on 5/31/16.
//  Copyright © 2016 Dolphin. All rights reserved.

We actually license under GPLv2+, so all rights actually aren't reserved.


Source/iOS/DolphiniOS/GameTableView.m, line 6 [r3] (raw file):

//
//  Created by Will Cobb on 11/4/15.
//  Copyright © 2015 iNDS. All rights reserved.

Same here (if this is taken from somewhere else, this is problematic)


Source/iOS/DolphiniOS/GameTableView.m, line 9 [r3] (raw file):

//

#import "GameTableView.h"

Paths should be relative.


Source/iOS/DolphiniOS/GCAdapteriOS.cpp, line 1 [r3] (raw file):

// Copyright 2014 Dolphin Emulator Project

This source file needs to be cleaned up.


Source/iOS/DolphiniOS/MainiOS.mm, line 1 [r3] (raw file):

Uh?


Source/iOS/DolphiniOS/RomTableViewController.h, line 6 [r3] (raw file):

//
//  Created by iNDS on 6/9/13.
//  Copyright (c) 2014 iNDS. All rights reserved.

Again, we don't reserve all rights.


Source/iOS/DolphiniOS/RomTableViewController.m, line 6 [r3] (raw file):

//
//  Created by iNDS on 6/9/13.
//  Copyright (c) 2014 iNDS. All rights reserved.

Ditto


Source/iOS/DolphiniOS/Controller/GCControllerView.m, line 6 [r3] (raw file):

//
//  Created by Will Cobb on 1/18/16.
//  Copyright © 2016 Will Cobb. All rights reserved.

Ditto about not reserving all rights


Source/iOS/DolphiniOS/Controller/GCControllerView.m, line 11 [r3] (raw file):

#import "GCControllerView.h"
#import "WCDirectionalControl.h"
//#include "InputCommon/GCPadStatus.h"

Don't leave uncommented code around. Also imports/includes should be relative.


Source/iOS/DolphiniOS/Controller/WCButtonControl.h, line 6 [r3] (raw file):

//
//  Created by CC on 7/5/13.
//  Copyright (c) 2014 CC. All rights reserved.

Ditto about rights being reserved.


Source/iOS/DolphiniOS/Controller/WCButtonControl.m, line 6 [r3] (raw file):

//
//  Created by Riley Testut on 7/5/13.
//  Copyright (c) 2014 CC. All rights reserved.

Ditto


Source/iOS/DolphiniOS/Controller/WCDirectionalControl.h, line 6 [r3] (raw file):

//
//  Created by CC
//  Copyright (c) 2014 CC. All rights reserved.

Ditto


Source/iOS/DolphiniOS/Controller/WCDirectionalControl.m, line 6 [r3] (raw file):

//
//  Created by CC
//  Copyright (c) 2014 CC. All rights reserved.

Ditto


Source/iOS/DolphiniOS/Roms/starfield.dol, line 0 [r3] (raw file):
Why is starfield being packaged with source code?


Comments from Reviewable

@WilliamLCobb
Copy link
Author

Review status: 23 of 246 files reviewed at latest revision, 46 unresolved discussions, some commit checks failed.


Source/Core/Common/Arm64Emitter.cpp, line 15 [r2] (raw file):

Previously, degasus (Markus Wick) wrote…

no need to hide array within IOS. It's either needed for all, or non.

It wouldn't compile without the include on iOS. It wasn't there before

Source/Core/Common/ArmCPUDetect.cpp, line 66 [r2] (raw file):

Previously, degasus (Markus Wick) wrote…

I think we should try to support this.

I agree, I'm not sure how though

Source/Core/Common/Network.h, line 11 [r2] (raw file):

Previously, degasus (Markus Wick) wrote…

Will an enum class help here?

Changed back to IOS. I'm use APPLE_IOS for the definition now

Source/Core/Common/GL/GLInterface/IGL.mm, line 53 [r2] (raw file):

Previously, degasus (Markus Wick) wrote…

why times 2?

Size is in points, not pixels. I changed this to make it more cear

Source/Core/Common/GL/GLInterface/IGL.mm, line 25 [r3] (raw file):

Previously, lioncash (Mat M.) wrote…

Please don't leave commented code all over the place.

Removed

Source/Core/Common/Logging/ConsoleListeneriOS.cpp, line 16 [r2] (raw file):

Previously, degasus (Markus Wick) wrote…

I wouldn't call this "ios", more like a generic one. If there isn't one (I haven't checked), please just rename this one to "Generic"

Removed log file completely. It ended up not being necessary

Source/Core/Core/PowerPC/JitArm64/JitArm64_BackPatch.cpp, line 20 [r2] (raw file):

Previously, degasus (Markus Wick) wrote…

Did this functions fail to compile, or just fail at execution? I'd like to see fastmem at some point :/

Failed to compile. MachineContext.h needs to be updated to support iOS

Source/Core/VideoBackends/OGL/Render.cpp, line 1340 [r2] (raw file):

Previously, degasus (Markus Wick) wrote…

Maybe within BlitScreen?

Just let me know where it should go

Source/iOS/DolphiniOS/EmulatorViewController.mm, line 9 [r3] (raw file):

Previously, lioncash (Mat M.) wrote…

These paths should be relative like the others

Relative paths are not generally usually used in Xcode projects. I can definitely change this though if they are preffered

Source/iOS/DolphiniOS/GameTableView.h, line 6 [r3] (raw file):

Previously, lioncash (Mat M.) wrote…

We actually license under GPLv2+, so all rights actually aren't reserved.

Xcode automatically adds this. I've removed them

Source/iOS/DolphiniOS/MainiOS.mm, line 1 [r3] (raw file):

Previously, lioncash (Mat M.) wrote…

Uh?

-_- not sure where the source went... I'll add it back

Source/iOS/DolphiniOS/Roms/starfield.dol, line [r3] (raw file):

Previously, lioncash (Mat M.) wrote…

Why is starfield being packaged with source code?

removed

Comments from Reviewable

@WilliamLCobb
Copy link
Author

Well I rebased the repo and now it's showing unknown repo in this pr and pushes from my fork aren't being updated. I'll close this and open a new pull request and only use force push from now on, unless someone knows how a way to fix this

@OatmealDome
Copy link
Member

Review status: 23 of 246 files reviewed at latest revision, 46 unresolved discussions, some commit checks failed.


Source/Core/Core/PowerPC/JitArm64/JitArm64_BackPatch.cpp, line 20 [r2] (raw file):

Previously, WilliamLCobb (Will Cobb) wrote…

Failed to compile. MachineContext.h needs to be updated to support iOS

I haven't tested it, but [here's](https://github.com/OatmealDome/dolphin/commit/b363dc5164a8bd2b75652bfd12e15ea5c11148d3) a MachineContext for iOS if you need it.

Comments from Reviewable

@WilliamLCobb
Copy link
Author

Review status: 23 of 246 files reviewed at latest revision, 46 unresolved discussions, some commit checks failed.


Source/Core/Core/PowerPC/JitArm64/JitArm64_BackPatch.cpp, line 20 [r2] (raw file):

Previously, OatmealDome wrote…

I haven't tested it, but here's a MachineContext for iOS if you need it.

Awesome! I added it

Comments from Reviewable

@WilliamLCobb WilliamLCobb changed the title Add iOS version of Dolphin Add iOS version of Dolphin Old Jun 6, 2016
@WilliamLCobb
Copy link
Author

Commits stopped updating to this PR. Moved to #3885

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

7 participants