Skip to content

Commit

Permalink
branch FB to three types.
Browse files Browse the repository at this point in the history
  • Loading branch information
miochen1226 committed Jan 4, 2024
1 parent 867b146 commit 5c08a11
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 18 deletions.
31 changes: 31 additions & 0 deletions NES_EMU.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
35265B3C26C5548F0031E1A6 /* Renderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35265B3A26C5548F0031E1A6 /* Renderer.swift */; };
35265B4026C566540031E1A6 /* Bitfield8WithPpuRegister.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35265B3F26C566540031E1A6 /* Bitfield8WithPpuRegister.swift */; };
35265B4126C566540031E1A6 /* Bitfield8WithPpuRegister.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35265B3F26C566540031E1A6 /* Bitfield8WithPpuRegister.swift */; };
352A30142B44035B0086A3B2 /* CPPTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 352A30122B44035B0086A3B2 /* CPPTest.cpp */; };
352A30152B44035B0086A3B2 /* CPPTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 352A30122B44035B0086A3B2 /* CPPTest.cpp */; };
352A301B2B4404710086A3B2 /* ObjcTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 352A301A2B4404710086A3B2 /* ObjcTest.mm */; };
352A301C2B4404710086A3B2 /* ObjcTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 352A301A2B4404710086A3B2 /* ObjcTest.mm */; };
352AFFE42A6E6DD100F811F8 /* Apu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 352AFFE32A6E6DD100F811F8 /* Apu.swift */; };
352AFFE52A6E6DD100F811F8 /* Apu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 352AFFE32A6E6DD100F811F8 /* Apu.swift */; };
352AFFE72A6E6EA800F811F8 /* AudioDriver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 352AFFE62A6E6EA800F811F8 /* AudioDriver.swift */; };
Expand Down Expand Up @@ -150,6 +154,12 @@
3525760F26BD5D5B005AB816 /* RomHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RomHeader.swift; sourceTree = "<group>"; };
35265B3A26C5548F0031E1A6 /* Renderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Renderer.swift; sourceTree = "<group>"; };
35265B3F26C566540031E1A6 /* Bitfield8WithPpuRegister.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bitfield8WithPpuRegister.swift; sourceTree = "<group>"; };
352A30102B44035A0086A3B2 /* NES_EMU (iOS)-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NES_EMU (iOS)-Bridging-Header.h"; sourceTree = "<group>"; };
352A30112B44035B0086A3B2 /* NES_EMU (macOS)-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NES_EMU (macOS)-Bridging-Header.h"; sourceTree = "<group>"; };
352A30122B44035B0086A3B2 /* CPPTest.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CPPTest.cpp; sourceTree = "<group>"; };
352A30132B44035B0086A3B2 /* CPPTest.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CPPTest.hpp; sourceTree = "<group>"; };
352A30192B4404710086A3B2 /* ObjcTest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ObjcTest.h; sourceTree = "<group>"; };
352A301A2B4404710086A3B2 /* ObjcTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ObjcTest.mm; sourceTree = "<group>"; };
352AFFE32A6E6DD100F811F8 /* Apu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Apu.swift; sourceTree = "<group>"; };
352AFFE62A6E6EA800F811F8 /* AudioDriver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioDriver.swift; sourceTree = "<group>"; };
352BF75F2A7295D40093CB65 /* ControllerPorts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ControllerPorts.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -279,6 +289,12 @@
3530B85526C6DD1200A2858C /* UI */,
352575E226BD4828005AB816 /* NES_EMUApp.swift */,
352575E426BD4829005AB816 /* Assets.xcassets */,
352A30122B44035B0086A3B2 /* CPPTest.cpp */,
352A30132B44035B0086A3B2 /* CPPTest.hpp */,
352A30102B44035A0086A3B2 /* NES_EMU (iOS)-Bridging-Header.h */,
352A30112B44035B0086A3B2 /* NES_EMU (macOS)-Bridging-Header.h */,
352A30192B4404710086A3B2 /* ObjcTest.h */,
352A301A2B4404710086A3B2 /* ObjcTest.mm */,
);
path = Shared;
sourceTree = "<group>";
Expand Down Expand Up @@ -506,9 +522,11 @@
TargetAttributes = {
352575E826BD4829005AB816 = {
CreatedOnToolsVersion = 12.3;
LastSwiftMigration = 1320;
};
352575F026BD4829005AB816 = {
CreatedOnToolsVersion = 12.3;
LastSwiftMigration = 1320;
};
};
};
Expand Down Expand Up @@ -576,6 +594,7 @@
3557FBB12A7C12E90059AA50 /* AudioUnitPlayer.swift in Sources */,
3557FBB32A7C12E90059AA50 /* AudioDriveImp.swift in Sources */,
356883232ADA3B4C0009AE7C /* IControllerPorts.swift in Sources */,
352A30142B44035B0086A3B2 /* CPPTest.cpp in Sources */,
3530FA3826BF6DCF00CF18DD /* Cpu.swift in Sources */,
3539627E2A83623800CF1E97 /* GameViewController.swift in Sources */,
3592DB1D2AD96E51003D52AD /* IApu.swift in Sources */,
Expand All @@ -590,6 +609,7 @@
358D403526C66CEB005AAAD8 /* SpriteFetchData.swift in Sources */,
35B9C57E26C291C700E13D57 /* PpuMemory.swift in Sources */,
3530FA5726BF880E00CF18DD /* Mapper.swift in Sources */,
352A301B2B4404710086A3B2 /* ObjcTest.mm in Sources */,
35714DD22AD3E5FB004A7A3F /* DmcChannel.swift in Sources */,
3538AD5A2AD91F0000787E9A /* Nes+GetSprite.swift in Sources */,
3539627C2A83619800CF1E97 /* VirtualConteollerView.swift in Sources */,
Expand Down Expand Up @@ -666,6 +686,7 @@
3592DB1E2AD96E51003D52AD /* IApu.swift in Sources */,
3525761126BD5D5B005AB816 /* RomHeader.swift in Sources */,
352575F626BD4829005AB816 /* NES_EMUApp.swift in Sources */,
352A301C2B4404710086A3B2 /* ObjcTest.mm in Sources */,
356883242ADA3B4C0009AE7C /* IControllerPorts.swift in Sources */,
352AFFE82A6E6EA800F811F8 /* AudioDriver.swift in Sources */,
3545B4E52A6D776F00C1E32E /* GameView.swift in Sources */,
Expand All @@ -676,6 +697,7 @@
35B78E2F2A86091100B1E42F /* Mapper4.swift in Sources */,
350858932A722B4100318C3D /* FrameCounter.swift in Sources */,
35B9C58426C29A5400E13D57 /* PpuMemoryBus.swift in Sources */,
352A30152B44035B0086A3B2 /* CPPTest.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -799,6 +821,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-iOS";
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 7;
Expand All @@ -816,6 +839,7 @@
PRODUCT_NAME = NES_EMU;
PROVISIONING_PROFILE_SPECIFIER = "NES-EMU-APPSTORE";
SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = "Shared/NES_EMU (iOS)-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -827,6 +851,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-iOS";
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 7;
Expand All @@ -843,6 +868,7 @@
PRODUCT_NAME = NES_EMU;
PROVISIONING_PROFILE_SPECIFIER = "NES-EMU-APPSTORE";
SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = "Shared/NES_EMU (iOS)-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
Expand All @@ -854,6 +880,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-Osx";
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = macOS/macOS.entitlements;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
Expand All @@ -872,6 +899,8 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.mio.NES-EMU";
PRODUCT_NAME = NES_EMU;
SDKROOT = macosx;
SWIFT_OBJC_BRIDGING_HEADER = "Shared/NES_EMU (macOS)-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Debug;
Expand All @@ -881,6 +910,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-Osx";
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "NES_EMU (macOS)Release.entitlements";
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
Expand All @@ -899,6 +929,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.mio.NES-EMU";
PRODUCT_NAME = NES_EMU;
SDKROOT = macosx;
SWIFT_OBJC_BRIDGING_HEADER = "Shared/NES_EMU (macOS)-Bridging-Header.h";
SWIFT_VERSION = 5.0;
};
name = Release;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,6 @@
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "1D96A132-2755-4D20-ADFF-A90A1D8BA9B3"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Shared/UI/GameScene.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "21"
endingLineNumber = "21"
landmarkName = "getFpsInfo()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
Expand Down
13 changes: 13 additions & 0 deletions Shared/CPPTest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// CPPTest.cpp
// NES_EMU
//
// Created by mio on 2024/1/2.
//

#include "CPPTest.hpp"

//cpp
void CPPTest::helloCPP(){
printf("Hello cpp!");
}
19 changes: 19 additions & 0 deletions Shared/CPPTest.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// CPPTest.hpp
// NES_EMU
//
// Created by mio on 2024/1/2.
//

#ifndef CPPTest_hpp
#define CPPTest_hpp

#include <stdio.h>

//header
class CPPTest{
public:
void helloCPP();
};

#endif /* CPPTest_hpp */
4 changes: 2 additions & 2 deletions Shared/NES/Cartridge/Cartridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,12 @@ class Cartridge: CartridgeBase {
//let filepath = bundleUrl!.appendingPathComponent("Super Mario Bros. (Japan, USA).nes")
//let filepath = bundleUrl!.appendingPathComponent("Donkey Kong (Japan).nes")
//let filepath = bundleUrl!.appendingPathComponent("Ice Climber (Japan).nes")
//let filepath = bundleUrl!.appendingPathComponent("Super Mario Bros. 3 (USA).nes")
let filepath = bundleUrl!.appendingPathComponent("Super Mario Bros. 3 (USA).nes")
//Takahashi Meijin no Bouken-jima (Japan).nes
//let filepath = bundleUrl!.appendingPathComponent("Blaster Master (USA).nes")


let filepath = bundleUrl!.appendingPathComponent("Chou-Wakusei Senki - MetaFight (J).nes")
//let filepath = bundleUrl!.appendingPathComponent("Chou-Wakusei Senki - MetaFight (J).nes")
//let filepath = bundleUrl!.appendingPathComponent("Super Mario Bros. 3 (USA).nes")
//Chou-Wakusei Senki - MetaFight (J)

Expand Down
5 changes: 5 additions & 0 deletions Shared/NES_EMU (iOS)-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//


4 changes: 4 additions & 0 deletions Shared/NES_EMU (macOS)-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import "ObjcTest.h"
17 changes: 17 additions & 0 deletions Shared/ObjcTest.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// ObjcTest.h
// NES_EMU
//
// Created by mio on 2024/1/2.
//

#import <Foundation/Foundation.h>


NS_ASSUME_NONNULL_BEGIN

@interface ObjcTest : NSObject
-(void)helloCPP;
@end

NS_ASSUME_NONNULL_END
17 changes: 17 additions & 0 deletions Shared/ObjcTest.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// ObjcTest.m
// NES_EMU
//
// Created by mio on 2024/1/2.
//

#import "ObjcTest.h"
#include "CPPTest.hpp"
@implementation ObjcTest

-(void)helloCPP {
CPPTest cppTest;
cppTest.helloCPP();
}

@end
3 changes: 3 additions & 0 deletions Shared/UI/GameScene.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import Foundation
import SpriteKit
import GameController


protocol IRenderScreen {
func renderScreen()
}

class GameScene: SKScene, IRenderScreen {

func getFpsInfo() -> String {

return nes.getFpsInfo()
}

Expand All @@ -26,6 +28,7 @@ class GameScene: SKScene, IRenderScreen {
DispatchQueue.main.async {
let viewSize = CGSize.init(width: self.view?.frame.width ?? 256, height: self.view?.frame.height ?? 240)
self.adjRenderCavansSize(viewSize)
ObjcTest().helloCPP()
self.renderBG()
}

Expand Down

0 comments on commit 5c08a11

Please sign in to comment.