[SniffEmu] v1.0.0
This commit is contained in:
parent
be79e482f6
commit
2afb5eba89
12
SniffEmu/.editorconfig
Executable file
12
SniffEmu/.editorconfig
Executable file
|
@ -0,0 +1,12 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
|
||||
[{Makefile}]
|
||||
indent_style = tab
|
||||
tab_size = 4
|
||||
|
||||
[{*.c,*.h}]
|
||||
indent_style = space
|
||||
tab_size = 4
|
4
SniffEmu/.gitignore
vendored
Executable file
4
SniffEmu/.gitignore
vendored
Executable file
|
@ -0,0 +1,4 @@
|
|||
_UAEFSDB.___
|
||||
dist/*.lha
|
||||
SniffEmu/Source/*.asm
|
||||
SniffEmu/Source/*.o
|
19
SniffEmu/LICENSE
Normal file
19
SniffEmu/LICENSE
Normal file
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2023-present BTHLabs <contact@bthlabs.pl> (https://bthlabs.pl)
|
||||
|
||||
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.
|
65
SniffEmu/README.md
Normal file
65
SniffEmu/README.md
Normal file
|
@ -0,0 +1,65 @@
|
|||
# SniffEmu
|
||||
|
||||
CLI tool to "detect" if the system is running in emulator
|
||||
|
||||
## Description
|
||||
|
||||
SniffEmu is a small CLI tool to "detect" if the system is running in
|
||||
emulation-like environment, e.g. UAE. I use it to conditionally execute parts
|
||||
of Startup-Sequence, e.g. to can skip FBlit when the OS is booting on PiStorm.
|
||||
|
||||
Usage: SniffEmu HELP/S RTG/S MODE
|
||||
|
||||
`MODE` is one of `EMU68`, `UAE` or `MUSASHI`. `RTG/S` allows you to
|
||||
specifically look for the emulator's RTG card, so you can e.g. set up the
|
||||
proper screen mode.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
> SniffEmu EMU68
|
||||
SniffEmu: Looking for board: 28019:-1... NOT FOUND
|
||||
```
|
||||
|
||||
```
|
||||
> SniffEmu RTG UAE
|
||||
SniffEmu: Looking for board: 2011:96... FOUND
|
||||
```
|
||||
|
||||
If the emulator (or RTG) was detected, the program will set the returncode to
|
||||
`WARN`. Otherwise, it'll be `OK`.
|
||||
|
||||
Example script:
|
||||
|
||||
```
|
||||
C:SniffEmu RTG UAE >NIL:
|
||||
If WARN
|
||||
Echo "Found UAE RTG!"
|
||||
EndIf
|
||||
```
|
||||
|
||||
Note: MUSASHI support is currently untested. If anybody uses it, let me know
|
||||
about the results ;).
|
||||
|
||||
## Requirements
|
||||
|
||||
AmigaOS 3.1+, MC68020+
|
||||
|
||||
## Changelog
|
||||
|
||||
Version 1.0.0 (16.02.2023)
|
||||
|
||||
* Initial release.
|
||||
|
||||
## Contributing
|
||||
|
||||
If you think you found a bug or want to send a patch, feel free to contact
|
||||
me through e-mail.
|
||||
|
||||
## Author
|
||||
|
||||
ScreenSaver is developed by [Tomek Wójcik](https://www.bthlabs.pl/).
|
||||
|
||||
## License
|
||||
|
||||
ScreenSaver is licensed under the MIT License.
|
BIN
SniffEmu/SniffEmu.info
Normal file
BIN
SniffEmu/SniffEmu.info
Normal file
Binary file not shown.
44
SniffEmu/SniffEmu/Readme
Executable file
44
SniffEmu/SniffEmu/Readme
Executable file
|
@ -0,0 +1,44 @@
|
|||
SniffEmu by BTHLabs
|
||||
|
||||
SniffEmu is a small CLI tool to "detect" if the system is running in
|
||||
emulation-like environment, e.g. UAE. I use it to conditionally execute parts
|
||||
of Startup-Sequence, e.g. to can skip FBlit when the OS is booting on PiStorm.
|
||||
|
||||
Usage: SniffEmu HELP/S RTG/S MODE
|
||||
|
||||
MODE is one of EMU68, UAE or MUSASHI. RTG/S allows you to specifically look
|
||||
for the emulator's RTG card, so you can e.g. set up the proper screen mode.
|
||||
|
||||
Example:
|
||||
|
||||
> SniffEmu EMU68
|
||||
SniffEmu: Looking for board: 28019:-1... NOT FOUND
|
||||
|
||||
> SniffEmu RTG UAE
|
||||
SniffEmu: Looking for board: 2011:96... FOUND
|
||||
|
||||
If the emulator (or RTG) was detected, the program will set the returncode to
|
||||
WARN. Otherwise, it'll be OK.
|
||||
|
||||
Example script:
|
||||
|
||||
C:SniffEmu RTG UAE >NIL:
|
||||
If WARN
|
||||
Echo "Found UAE RTG!"
|
||||
EndIf
|
||||
|
||||
Note: MUSASHI support is currently untested. If anybody uses it, let me know
|
||||
about the results ;).
|
||||
|
||||
Requirements: AmigaOS 3.1+, MC68020+
|
||||
|
||||
SniffEmu is developed by Tomek Wójcik
|
||||
|
||||
SniffEmu is licensed under the MIT License.
|
||||
|
||||
Changelog
|
||||
---------
|
||||
|
||||
Version 1.0.0 (16.02.2023)
|
||||
|
||||
* Initial release.
|
BIN
SniffEmu/SniffEmu/Readme.info
Normal file
BIN
SniffEmu/SniffEmu/Readme.info
Normal file
Binary file not shown.
BIN
SniffEmu/SniffEmu/SniffEmu
Executable file
BIN
SniffEmu/SniffEmu/SniffEmu
Executable file
Binary file not shown.
BIN
SniffEmu/SniffEmu/Source.info
Normal file
BIN
SniffEmu/SniffEmu/Source.info
Normal file
Binary file not shown.
18
SniffEmu/SniffEmu/Source/Makefile
Executable file
18
SniffEmu/SniffEmu/Source/Makefile
Executable file
|
@ -0,0 +1,18 @@
|
|||
DEVPACK := DEVPACK:
|
||||
VBCC := $(DEVPACK)VBCC
|
||||
|
||||
CC := $(VBCC)/bin/vc
|
||||
|
||||
OUTFILE := /SniffEmu
|
||||
|
||||
OBJECTS := SniffEmu.o
|
||||
CFLAGS := -I$(DEVPACK)ADE/os-include
|
||||
LIBS := -lamiga
|
||||
|
||||
all: $(OUTFILE)
|
||||
|
||||
clean:
|
||||
Delete ALL FORCE $(OUTFILE) $(OBJECTS)
|
||||
|
||||
$(OUTFILE): $(OBJECTS)
|
||||
$(CC) $(LIBS) -o $(OUTFILE) $(OBJECTS)
|
164
SniffEmu/SniffEmu/Source/SniffEmu.c
Executable file
164
SniffEmu/SniffEmu/Source/SniffEmu.c
Executable file
|
@ -0,0 +1,164 @@
|
|||
/*
|
||||
* SniffEmu by BTHLabs
|
||||
* Copyright (c) 2023-present BTHLabs <contact@bthlabs.pl> (https://bthlabs.pl)
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <libraries/configregs.h>
|
||||
#include <libraries/configvars.h>
|
||||
#include <libraries/expansion.h>
|
||||
#include <proto/dos.h>
|
||||
#include <proto/expansion.h>
|
||||
|
||||
#include "SniffEmu.h"
|
||||
|
||||
struct ExpansionBase * ExpansionBase;
|
||||
|
||||
static STRPTR verstring = APP_VSTRING;
|
||||
|
||||
static char *MODE_NAME_EMU68 = "EMU68";
|
||||
static char *MODE_NAME_UAE = "UAE";
|
||||
static char *MODE_NAME_MUSASHI = "MUSASHI";
|
||||
|
||||
#define TEMPLATE "HELP/S,RTG/S,MODE"
|
||||
|
||||
typedef enum {
|
||||
OPT_HELP,
|
||||
OPT_RTG,
|
||||
OPT_MODE,
|
||||
OPT_COUNT
|
||||
} OPT_ARGS;
|
||||
|
||||
typedef enum {
|
||||
MODE_UNKNOWN,
|
||||
MODE_EMU68,
|
||||
MODE_UAE,
|
||||
MODE_MUSASHI
|
||||
} MODE;
|
||||
|
||||
int help() {
|
||||
printf(
|
||||
"SniffEmu %s by BTHLabs\n"
|
||||
"Developed by Tomek Wójcik\n"
|
||||
"bthlabs.pl | MIT License\n",
|
||||
VERSION
|
||||
);
|
||||
|
||||
printf(
|
||||
"\n"
|
||||
"Usage: SniffEmu HELP/S RTG/S MODE\n"
|
||||
"\n"
|
||||
"HELP : Print this help\n"
|
||||
"RTG : Sniff the RTG board\n"
|
||||
"MODE : Specify the emulator to sniff\n"
|
||||
" Valid values: EMU68, UAE, MUSASHI\n"
|
||||
);
|
||||
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
int find_board(int manufacturer, int product) {
|
||||
int result = RETURN_OK;
|
||||
|
||||
printf("SniffEmu: Looking for board: %d:%d... ", manufacturer, product);
|
||||
|
||||
if (ExpansionBase = (struct ExpansionBase *)OpenLibrary(EXPANSIONNAME, 0L)) {
|
||||
struct ConfigDev* cd = NULL;
|
||||
|
||||
while (cd = FindConfigDev(cd, manufacturer, product)) {
|
||||
result = RETURN_WARN;
|
||||
}
|
||||
}
|
||||
|
||||
if (result == RETURN_WARN) {
|
||||
printf("FOUND\n");
|
||||
} else {
|
||||
printf("NOT FOUND\n");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int result = RETURN_OK;
|
||||
int opts[OPT_COUNT];
|
||||
struct RDArgs *rdargs;
|
||||
int manufacturer = -1;
|
||||
int product = -1;
|
||||
|
||||
if (argc > 1) {
|
||||
memset((char *)opts, 0, sizeof(opts));
|
||||
|
||||
if (rdargs = (struct RDArgs *)ReadArgs(TEMPLATE, opts, NULL)) {
|
||||
if (opts[OPT_HELP]) {
|
||||
result = help();
|
||||
} else {
|
||||
MODE mode = MODE_UNKNOWN;
|
||||
|
||||
if (strcmp((STRPTR)opts[OPT_MODE], MODE_NAME_EMU68) == 0) {
|
||||
mode = MODE_EMU68;
|
||||
} else if (strcmp((STRPTR)opts[OPT_MODE], MODE_NAME_UAE) == 0) {
|
||||
mode = MODE_UAE;
|
||||
} else if (strcmp((STRPTR)opts[OPT_MODE], MODE_NAME_MUSASHI) == 0) {
|
||||
/* MUSASHI mode is untested. */
|
||||
mode = MODE_MUSASHI;
|
||||
} else {
|
||||
printf("SniffEmu: Invalid MODE: `%s`\n", opts[OPT_MODE]);
|
||||
result = help();
|
||||
}
|
||||
|
||||
if (mode != MODE_UNKNOWN) {
|
||||
if (mode == MODE_EMU68) {
|
||||
manufacturer = EMU68_MANUFACTURER;
|
||||
} else if (mode == MODE_UAE) {
|
||||
manufacturer = UAE_MANUFACTURER;
|
||||
} else if (mode == MODE_MUSASHI) {
|
||||
manufacturer = MUSASHI_MANUFACTURER;
|
||||
product = MUSASHI_INTERACTION;
|
||||
}
|
||||
|
||||
if (opts[OPT_RTG]) {
|
||||
if (mode == MODE_EMU68) {
|
||||
product = EMU68_RTG;
|
||||
} else if (mode == MODE_UAE) {
|
||||
product = UAE_RTG;
|
||||
} else if (mode == MODE_MUSASHI) {
|
||||
printf("SniffEmu: Can't reliably sniff RTG on Musashi :(\n");
|
||||
product = MUSASHI_RTG;
|
||||
}
|
||||
}
|
||||
|
||||
result = find_board(manufacturer, product);
|
||||
}
|
||||
}
|
||||
|
||||
FreeArgs(rdargs);
|
||||
} else {
|
||||
printf("SniffEmu: Invalid arguments.\n");
|
||||
result = help();
|
||||
}
|
||||
} else {
|
||||
result = help();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
17
SniffEmu/SniffEmu/Source/SniffEmu.h
Executable file
17
SniffEmu/SniffEmu/Source/SniffEmu.h
Executable file
|
@ -0,0 +1,17 @@
|
|||
#ifndef __SNIFFEMU_H__
|
||||
#define __SNIFFEMU_H__
|
||||
|
||||
#define VERSION "1.0.0"
|
||||
#define DATE "16.02.2023"
|
||||
|
||||
#define APP_VSTRING "$VER: SniffEmu " VERSION " (" DATE ")"
|
||||
|
||||
#define EMU68_MANUFACTURER (0x6d73)
|
||||
#define EMU68_RTG (0x24)
|
||||
#define UAE_MANUFACTURER (0x7db)
|
||||
#define UAE_RTG (0x60)
|
||||
#define MUSASHI_MANUFACTURER (0x7db)
|
||||
#define MUSASHI_INTERACTION (0x6b)
|
||||
#define MUSASHI_RTG (0x6b)
|
||||
|
||||
#endif
|
52
SniffEmu/dist/SniffEmu.readme
vendored
Normal file
52
SniffEmu/dist/SniffEmu.readme
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
Short: CLI tool to "detect" if the system is running in emulator
|
||||
Author: Tomek Wójcik <contact@bthlabs.pl>
|
||||
Uploader: Tomek Wójcik <contact@bthlabs.pl>
|
||||
Type: util/sys
|
||||
Version: 1.0.0
|
||||
Architecture: m68k-amigaos
|
||||
Requires: AmigaOS 3.1+, MC68020+
|
||||
|
||||
SniffEmu by BTHLabs
|
||||
|
||||
SniffEmu is a small CLI tool to "detect" if the system is running in
|
||||
emulation-like environment, e.g. UAE. I use it to conditionally execute parts
|
||||
of Startup-Sequence, e.g. to can skip FBlit when the OS is booting on PiStorm.
|
||||
|
||||
Usage: SniffEmu HELP/S RTG/S MODE
|
||||
|
||||
MODE is one of EMU68, UAE or MUSASHI. RTG/S allows you to specifically look
|
||||
for the emulator's RTG card, so you can e.g. set up the proper screen mode.
|
||||
|
||||
Example:
|
||||
|
||||
> SniffEmu EMU68
|
||||
SniffEmu: Looking for board: 28019:-1... NOT FOUND
|
||||
|
||||
> SniffEmu RTG UAE
|
||||
SniffEmu: Looking for board: 2011:96... FOUND
|
||||
|
||||
If the emulator (or RTG) was detected, the program will set the returncode to
|
||||
WARN. Otherwise, it'll be OK.
|
||||
|
||||
Example script:
|
||||
|
||||
C:SniffEmu RTG UAE >NIL:
|
||||
If WARN
|
||||
Echo "Found UAE RTG!"
|
||||
EndIf
|
||||
|
||||
Note: MUSASHI support is currently untested. If anybody uses it, let me know
|
||||
about the results ;).
|
||||
|
||||
Requirements: AmigaOS 3.1+, MC68020+
|
||||
|
||||
SniffEmu is developed by Tomek Wójcik
|
||||
|
||||
SniffEmu is licensed under the MIT License.
|
||||
|
||||
Changelog
|
||||
---------
|
||||
|
||||
Version 1.0.0 (16.02.2023)
|
||||
|
||||
* Initial release.
|
Loading…
Reference in New Issue
Block a user