mirror of
https://gitea.tendokyu.moe/ppc/amnet.git
synced 2026-10-06 13:48:10 +03:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71f343e9b5 | ||
|
|
270c65cddb | ||
|
|
21766ae449 | ||
|
|
0bb34f04be | ||
|
|
1e5e8b3a4d | ||
|
|
805af19006 |
@@ -8,15 +8,14 @@ namespace AMNet.Server;
|
||||
internal static class Config
|
||||
{
|
||||
internal const string IOSection = "aimeio";
|
||||
private const string ConfigFileName = @".\segatools.ini";
|
||||
|
||||
static Config()
|
||||
{
|
||||
GameId = ReadKey(IOSection, "gameId", 4);
|
||||
ServerName = ReadKey(IOSection, "serverName", 26, Environment.MachineName);
|
||||
|
||||
PhysicalCardUseIDm = PInvoke.GetPrivateProfileInt(IOSection, "useAimeDBForPhysicalCards", 0, ConfigFileName) > 0;
|
||||
EnableAimeTxt = PInvoke.GetPrivateProfileInt(IOSection, "enableKeyboardMode", 1, ConfigFileName) > 0;
|
||||
PhysicalCardUseIDm = PInvoke.GetPrivateProfileInt(IOSection, "useAimeDBForPhysicalCards", 0, ConfigFilePath) > 0;
|
||||
EnableAimeTxt = PInvoke.GetPrivateProfileInt(IOSection, "enableKeyboardMode", 1, ConfigFilePath) > 0;
|
||||
AimeTxtPath = ReadKey("aime", "aimePath", PInvoke.MAX_PATH, @"DEVICE\aime.txt");
|
||||
}
|
||||
|
||||
@@ -44,13 +43,15 @@ internal static class Config
|
||||
|
||||
public static Version ServerVersion { get; } = new(Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyFileVersionAttribute>()?.Version ?? "1.0");
|
||||
|
||||
private static string ConfigFilePath { get; } = Environment.GetEnvironmentVariable("SEGATOOLS_CONFIG_PATH") ?? ".\\segatools.ini";
|
||||
|
||||
internal static unsafe string ReadKey(string section, string key, uint maxLength, string @default = null)
|
||||
{
|
||||
// +1 for null terminator
|
||||
var buffer = stackalloc char[(int)maxLength + 1];
|
||||
var bufferStr = new PWSTR(buffer);
|
||||
|
||||
PInvoke.GetPrivateProfileString(section, key, @default ?? string.Empty, bufferStr, maxLength + 1, ConfigFileName);
|
||||
PInvoke.GetPrivateProfileString(section, key, @default ?? string.Empty, bufferStr, maxLength + 1, ConfigFilePath);
|
||||
return bufferStr.ToString();
|
||||
}
|
||||
}
|
||||
+10
-2
@@ -12,12 +12,20 @@
|
||||
"applinks:card.ppc.moe"
|
||||
],
|
||||
"infoPlist": {
|
||||
"NSAppTransportSecurity": {
|
||||
"NSAllowsArbitraryLoads": true
|
||||
},
|
||||
"UIViewControllerBasedStatusBarAppearance": "NO",
|
||||
"NFCReaderUsageDescription": "AMNet uses NFC to scan Physical IC Cards",
|
||||
"com.apple.developer.nfc.readersession.felica.systemcodes": ["0003", "88b4"]
|
||||
"com.apple.developer.nfc.readersession.felica.systemcodes": [
|
||||
"0003",
|
||||
"88b4"
|
||||
]
|
||||
},
|
||||
"entitlements": {
|
||||
"com.apple.developer.nfc.readersession.formats": ["TAG"]
|
||||
"com.apple.developer.nfc.readersession.formats": [
|
||||
"TAG"
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
"usesNonExemptEncryption": false
|
||||
|
||||
@@ -80,7 +80,7 @@ export default function ServerAddModal({route, navigation}) {
|
||||
}
|
||||
|
||||
navigation.goBack();
|
||||
setTimeout(() => navigation.navigate('server', {
|
||||
setTimeout(() => navigation.popTo('server', {
|
||||
serverId: serverObject._id.toHexString()
|
||||
}), 500);
|
||||
}, [realm]);
|
||||
@@ -127,7 +127,7 @@ function handleDeepLink(realm, navigation, route, setAddress: (address: string)
|
||||
navigation.goBack();
|
||||
|
||||
// allow the homepage to render before moving on
|
||||
setTimeout(() => navigation.navigate('server', {
|
||||
setTimeout(() => navigation.popTo('server', {
|
||||
serverId: item[0]._id.toHexString()
|
||||
}), 1000);
|
||||
} else {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import {Text} from "react-native";
|
||||
import {ReactNode, useMemo} from "react";
|
||||
import {CreditCard, History, Joystick, RailSymbol} from "lucide-react-native";
|
||||
import React, {ReactNode, useMemo} from "react";
|
||||
import {CreditCard, Gem, History, Joystick, LucideIcon, RailSymbol} from "lucide-react-native";
|
||||
|
||||
import TimeAgo from "./TimeAgo";
|
||||
import {AMUICard, AMUICardActionProps, AMUICardDetail} from "./AMUICard";
|
||||
|
||||
import {AMCardData, AMPhysicalCardData} from "../models/AMCard";
|
||||
import {AMCardData} from "../models/AMCard";
|
||||
import {AmusementICVendor, ICType} from "../lib/iccard";
|
||||
|
||||
export interface ICCardProps extends AMUICardActionProps {
|
||||
@@ -22,7 +22,7 @@ export function ICCard(props: ICCardProps) {
|
||||
|
||||
return (
|
||||
<AMUICard title={props.card.name} {...props}>
|
||||
<PhysicalICInfo physicalCard={props.card.physicalCardData}/>
|
||||
<PhysicalICInfo card={props.card}/>
|
||||
|
||||
<AMUICardDetail>
|
||||
<CreditCard size={18} color="gray"/>
|
||||
@@ -40,8 +40,8 @@ export function ICCard(props: ICCardProps) {
|
||||
);
|
||||
}
|
||||
|
||||
function PhysicalICInfo(props: { physicalCard: AMPhysicalCardData | null }) {
|
||||
if (props.physicalCard?.cardType === ICType.Transport) {
|
||||
function PhysicalICInfo(props: { card: AMCardData | null }) {
|
||||
if (props.card.physicalCardData?.cardType === ICType.Transport) {
|
||||
return (
|
||||
<AMUICardDetail>
|
||||
<RailSymbol size={18} color="gray"/>
|
||||
@@ -50,12 +50,13 @@ function PhysicalICInfo(props: { physicalCard: AMPhysicalCardData | null }) {
|
||||
)
|
||||
}
|
||||
|
||||
if (props.physicalCard?.cardVendor) {
|
||||
if (props.card.physicalCardData?.cardVendor) {
|
||||
const [icon, color]: [LucideIcon, string] = props.card.isLimitedAimeCard ? [Gem, "crimson"] : [Joystick, "gray"];
|
||||
return (
|
||||
<AMUICardDetail>
|
||||
<Joystick size={18} color="gray"/>
|
||||
<Text style={{color: "gray"}}>
|
||||
{props.physicalCard.isBootlegAmusementCard ? "Bootleg " : null}{ICVendorName(props.physicalCard.cardVendor)}
|
||||
{React.createElement(icon, {size: 18, color})}
|
||||
<Text style={{color}}>
|
||||
{props.card.physicalCardData.isBootlegAmusementCard ? "Bootleg " : null}{ICVendorName(props.card.physicalCardData.cardVendor)}
|
||||
</Text>
|
||||
</AMUICardDetail>
|
||||
);
|
||||
|
||||
@@ -70,7 +70,6 @@ export async function felicaCardReadAsync(): Promise<ICCard | null> {
|
||||
return null;
|
||||
}
|
||||
} catch (ex) {
|
||||
console.warn(ex);
|
||||
return null;
|
||||
} finally {
|
||||
await NfcManager.cancelTechnologyRequest();
|
||||
|
||||
@@ -7,6 +7,7 @@ export interface AMCardData {
|
||||
|
||||
added: Date;
|
||||
lastUsed?: Date | null;
|
||||
isLimitedAimeCard: boolean;
|
||||
physicalCardData?: AMPhysicalCardData | null;
|
||||
}
|
||||
|
||||
@@ -22,6 +23,11 @@ export class AMCard extends Realm.Object<AMCard> implements AMCardData {
|
||||
|
||||
physicalCardData?: AMPhysicalCardData | null = null;
|
||||
|
||||
get isLimitedAimeCard() {
|
||||
// limited cards use the company code 500
|
||||
return this.physicalCardData?.cardType === ICType.Amusement && this.code.startsWith('500');
|
||||
}
|
||||
|
||||
static generate(code: string, name: string) {
|
||||
return {
|
||||
_id: new Realm.BSON.ObjectId(),
|
||||
|
||||
Generated
+633
-123
File diff suppressed because it is too large
Load Diff
+16
-13
@@ -9,40 +9,43 @@
|
||||
"android-prebuild": "expo prebuild --platform android"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.26.0",
|
||||
"@babel/runtime": "^7.26.7",
|
||||
"@expo-google-fonts/jetbrains-mono": "^0.2.3",
|
||||
"@react-navigation/bottom-tabs": "^6.6.1",
|
||||
"@react-navigation/native": "^6.1.18",
|
||||
"@react-navigation/native-stack": "^6.11.0",
|
||||
"@react-navigation/bottom-tabs": "^7.2.0",
|
||||
"@react-navigation/native": "^7.0.14",
|
||||
"@react-navigation/native-stack": "^7.2.0",
|
||||
"@realm/react": "^0.11.0",
|
||||
"@types/react": "~18.3.12",
|
||||
"amnet-shared": "file:../amnet-shared",
|
||||
"date-fns": "^3.6.0",
|
||||
"expo": "^52.0.27",
|
||||
"date-fns": "^4.1.0",
|
||||
"expo": "^52.0.30",
|
||||
"expo-blur": "~14.0.3",
|
||||
"expo-build-properties": "~0.13.2",
|
||||
"expo-clipboard": "~7.0.1",
|
||||
"expo-constants": "~17.0.3",
|
||||
"expo-dev-client": "~5.0.10",
|
||||
"expo-linking": "~7.0.4",
|
||||
"expo-dev-client": "~5.0.11",
|
||||
"expo-linking": "~7.0.5",
|
||||
"expo-splash-screen": "~0.29.21",
|
||||
"expo-status-bar": "~2.0.1",
|
||||
"expo-system-ui": "~4.0.7",
|
||||
"lucide-react-native": "^0.427.0",
|
||||
"pusher-js": "^8.2.0",
|
||||
"lucide-react-native": "^0.474.0",
|
||||
"pusher-js": "^8.4.0",
|
||||
"react": "18.3.1",
|
||||
"react-native": "0.76.6",
|
||||
"react-native-context-menu-view": "^1.16.0",
|
||||
"react-native-gesture-handler": "~2.20.2",
|
||||
"react-native-get-random-values": "^1.11.0",
|
||||
"react-native-nfc-manager": "^3.16.1",
|
||||
"react-native-paper": "^5.12.5",
|
||||
"react-native-paper": "^5.13.1",
|
||||
"react-native-reanimated": "~3.16.1",
|
||||
"react-native-safe-area-context": "4.12.0",
|
||||
"react-native-screens": "~4.4.0",
|
||||
"react-native-svg": "15.8.0",
|
||||
"react-native-url-polyfill": "^2.0.0",
|
||||
"realm": "^12.14.0",
|
||||
"typescript": "~5.3.3",
|
||||
"expo-splash-screen": "~0.29.21"
|
||||
"typescript": "~5.3.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@expo/ngrok": "^4.1.3"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user