commit 2aa320a4d437a4417d047992b49e5e5e963b3819 Author: Rin Date: Sat Jul 9 10:56:19 2022 +0100 Initial commit, really not sure if this works. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8a30d25 --- /dev/null +++ b/.gitignore @@ -0,0 +1,398 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c879e4b --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright 2022 Luna + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/OpenBanapass.sln b/OpenBanapass.sln new file mode 100644 index 0000000..f66be98 --- /dev/null +++ b/OpenBanapass.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32616.157 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenBanapass", "OpenBanapass\OpenBanapass.vcxproj", "{60323063-5A42-4B1C-8A61-9FBDD6EF2095}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {60323063-5A42-4B1C-8A61-9FBDD6EF2095}.Debug|x64.ActiveCfg = Debug|x64 + {60323063-5A42-4B1C-8A61-9FBDD6EF2095}.Debug|x64.Build.0 = Debug|x64 + {60323063-5A42-4B1C-8A61-9FBDD6EF2095}.Debug|x86.ActiveCfg = Debug|Win32 + {60323063-5A42-4B1C-8A61-9FBDD6EF2095}.Debug|x86.Build.0 = Debug|Win32 + {60323063-5A42-4B1C-8A61-9FBDD6EF2095}.Release|x64.ActiveCfg = Release|x64 + {60323063-5A42-4B1C-8A61-9FBDD6EF2095}.Release|x64.Build.0 = Release|x64 + {60323063-5A42-4B1C-8A61-9FBDD6EF2095}.Release|x86.ActiveCfg = Release|Win32 + {60323063-5A42-4B1C-8A61-9FBDD6EF2095}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9BFEAAB3-D68B-4645-9648-DB660BFEED24} + EndGlobalSection +EndGlobal diff --git a/OpenBanapass/OpenBanapass.vcxproj b/OpenBanapass/OpenBanapass.vcxproj new file mode 100644 index 0000000..7455b03 --- /dev/null +++ b/OpenBanapass/OpenBanapass.vcxproj @@ -0,0 +1,168 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {60323063-5a42-4b1c-8a61-9fbdd6ef2095} + OpenBanapass + 10.0 + + + + DynamicLibrary + true + v143 + Unicode + + + DynamicLibrary + false + v143 + true + Unicode + + + DynamicLibrary + true + v143 + Unicode + + + DynamicLibrary + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + OpenBanapass + + + OpenBanapass + + + OpenBanapass + + + OpenBanapass + + + + Level3 + true + WIN32;_DEBUG;OPENBANAPASS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + false + + + + + Level3 + true + true + true + WIN32;NDEBUG;OPENBANAPASS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + true + true + false + + + + + Level3 + true + _DEBUG;OPENBANAPASS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + NotUsing + pch.h + + + Windows + true + false + + + + + Level3 + true + true + true + NDEBUG;OPENBANAPASS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + true + true + false + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OpenBanapass/OpenBanapass.vcxproj.filters b/OpenBanapass/OpenBanapass.vcxproj.filters new file mode 100644 index 0000000..037ac2c --- /dev/null +++ b/OpenBanapass/OpenBanapass.vcxproj.filters @@ -0,0 +1,39 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/OpenBanapass/banapass.cpp b/OpenBanapass/banapass.cpp new file mode 100644 index 0000000..d60686f --- /dev/null +++ b/OpenBanapass/banapass.cpp @@ -0,0 +1,164 @@ +#include "banapass.h" +#include "log.h" + +#define BANA_API_VERSION "Ver 1.6.0" + +ULONGLONG BngRwAttach(UINT a1, char* a2, int a3, int a4, void* callback, long a6) +{ + log("BngRwAttach()\n"); + // Do something with the callback perhaps? + // Idk what it does + return 1; +} + +long BngRwInit() +{ + log("BngRwInit()\n"); + return 0; +} + +ULONGLONG BngRwReqSetLedPower() +{ + log("BngRwSetLedPower()\n"); + return 0; +} + +int BngRwDevReset(UINT a, ULONGLONG b, ULONGLONG c) +{ + log("BngRwDevReset()\n"); + return 0; +} + +ULONGLONG BngRwExReadMifareAllBlock() +{ + log("BngRwExReadMifareAllBlock()\n"); + return 0xffffff9c; +} + +// Finalise? +void BngRwFin() +{ + log("BngRwFin()\n"); +} + +UINT BngRwGetFwVersion(UINT a) +{ + log("BngRwGetFwVersion()\n"); + return 0; +} + +UINT BngRwGetStationID(UINT a) +{ + log("BngRwGetStationID()\n"); + return 0; +} + +const char* BngRwGetVersion() +{ + log("BngRwGetVersion()\n"); + return BANA_API_VERSION; +} + +ULONGLONG BngRwIsCmdExec(UINT a) +{ + log("BngRwIsCmdExec()\n"); + return 0xFFFFFFFF; +} + +UINT BngRwGetTotalRetryCount(UINT a) +{ + log("BngRwGetTotalRetryCount()\n"); + return 0; +} + +int BngRwReqLed(UINT a, UINT b, ULONGLONG c, ULONGLONG d) +{ + log("BngRwReqLed()\n"); + return 1; +} + +int BngRwReqAction(UINT a, UINT b, ULONGLONG c, ULONGLONG d) +{ + log("BngRwReqAction()\n"); + return 1; +} + +int BngRwReqAiccAuth(UINT a, int b, UINT c, int* d, ULONGLONG e, ULONGLONG f, ULONGLONG* g) +{ + log("BngRwReqAiccAuth()\n"); + return 1; +} + +int BngRwReqBeep(UINT a, UINT b, ULONGLONG c, ULONGLONG d) +{ + log("BngRwReqBeep()\n"); + return 1; +} + +int BngRwReqCancel(UINT a) +{ + log("BngRwReqCancel()\n"); + if (7 < a) + { + return -100; + } + return 1; +} + +int BngRwReqFwCleanup(UINT, ULONGLONG, ULONGLONG) +{ + log("BngRwReqFwCleanup()\n"); + return 1; +} + +int BngRwReqFwVersionup(UINT a, ULONGLONG b, ULONGLONG c, ULONGLONG d) +{ + log("BngRwReqFwVersionup()\n"); + return 1; +} + +int BngRwReqLatchID(UINT a, ULONGLONG b, ULONGLONG c) +{ + log("BngRwReqLatchId()\n"); + if (a < 8) + { + return -100; + } + return 1; +} + +int BngRwReqSendMailTo(UINT a, int b, UINT c, int* d, + char* e, char* f, char* g, char* h, ULONGLONG i, ULONGLONG j) +{ + log("BngRwReqSendMailTo()\n"); + if (7 < a) + { + return -100; + } + if (!e) + { + return -100; + } + return 1; +} + +int BngRwReqSendUrlTo(UINT a, int b, UINT c, int* d, + char* e, char* f, ULONGLONG g, ULONGLONG h) +{ + log("BngRwReqSendUrlTo()\n"); + if (7 < a) + { + return -100; + } + if (!e) + { + return -100; + } + return 1; +} + +int BngRwReqWaitTouch(UINT a, int b, UINT c, ULONGLONG d, ULONGLONG e) +{ + log("BngRwReqWaitTouch()\n"); + return GetAsyncKeyState(VK_RETURN) ? 0 : -1; +} \ No newline at end of file diff --git a/OpenBanapass/banapass.h b/OpenBanapass/banapass.h new file mode 100644 index 0000000..9763b3d --- /dev/null +++ b/OpenBanapass/banapass.h @@ -0,0 +1,28 @@ +#pragma once + +#define BANA_API __declspec(dllexport) +#define WIN32_LEAN_AND_MEAN +#include + +BANA_API ULONGLONG BngRwAttach(UINT, char*, int, int, void*, long); +BANA_API int BngRwDevReset(UINT, ULONGLONG, ULONGLONG); +BANA_API ULONGLONG BngRwExReadMifareAllBlock(); +BANA_API void BngRwFin(); +BANA_API UINT BngRwGetFwVersion(UINT); +BANA_API UINT BngRwGetStationID(UINT); +BANA_API UINT BngRwGetTotalRetryCount(UINT); +BANA_API const char* BngRwGetVersion(); +BANA_API long BngRwInit(); +BANA_API ULONGLONG BngRwIsCmdExec(UINT); +BANA_API int BngRwReqAction(UINT, UINT, ULONGLONG, ULONGLONG); +BANA_API int BngRwReqAiccAuth(UINT, int, UINT, int*, ULONGLONG, ULONGLONG, ULONGLONG*); +BANA_API int BngRwReqBeep(UINT, UINT, ULONGLONG, ULONGLONG); +BANA_API int BngRwReqCancel(UINT); +BANA_API int BngRwReqFwCleanup(UINT, ULONGLONG, ULONGLONG); +BANA_API int BngRwReqFwVersionup(UINT, ULONGLONG, ULONGLONG, ULONGLONG); +BANA_API int BngRwReqLatchID(UINT, ULONGLONG, ULONGLONG); +BANA_API int BngRwReqLed(UINT, UINT, ULONGLONG, ULONGLONG); +BANA_API int BngRwReqSendMailTo(UINT, int, UINT, int*, char*, char*, char*, char*, ULONGLONG, ULONGLONG); +BANA_API int BngRwReqSendUrlTo(UINT, int, UINT, int*, char*, char*, ULONGLONG, ULONGLONG); +BANA_API int BngRwReqWaitTouch(UINT, int, UINT, ULONGLONG, ULONGLONG); +BANA_API ULONGLONG BngRwReqSetLedPower(); \ No newline at end of file diff --git a/OpenBanapass/cpp.hint b/OpenBanapass/cpp.hint new file mode 100644 index 0000000..7b2307a --- /dev/null +++ b/OpenBanapass/cpp.hint @@ -0,0 +1,2 @@ +#define OPENBANAPASS_API __declspec(dllexport) +#define OPENBANAPASS_API __declspec(dllimport) diff --git a/OpenBanapass/dllmain.cpp b/OpenBanapass/dllmain.cpp new file mode 100644 index 0000000..855dab9 --- /dev/null +++ b/OpenBanapass/dllmain.cpp @@ -0,0 +1,22 @@ +// dllmain.cpp : Defines the entry point for the DLL application. +#define WIN32_LEAN_AND_MEAN +#include + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + // Initialisation code here... + break; + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + diff --git a/OpenBanapass/log.cpp b/OpenBanapass/log.cpp new file mode 100644 index 0000000..450208c --- /dev/null +++ b/OpenBanapass/log.cpp @@ -0,0 +1,14 @@ +#include "log.h" +#include +#include +#include +#include + +void log(const char* format, ...) +{ + va_list args; + va_start(args, format); + printf("[OpenBanapass] "); + vprintf(format, args); + va_end(args); +} \ No newline at end of file diff --git a/OpenBanapass/log.h b/OpenBanapass/log.h new file mode 100644 index 0000000..c606de9 --- /dev/null +++ b/OpenBanapass/log.h @@ -0,0 +1,3 @@ +#pragma once + +void log(const char* format, ...); \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..3c576a9 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# OpenBanapass +An open-source Banapassport API DLL replacement for Wangan Midnight Maximum Tune 6. + +## Notes +This project is part of [Project Asakura](https://github.com/ProjectAsakura), a network reimplementation project for Maximum Tune 6. +It might not work properly when used outside of this project, but you're free to contribute. + +## Special thanks + - [derole](https://derole.co.uk) - code, technical help \ No newline at end of file