Giter VIP home page Giter VIP logo

squally's Introduction

Squalr

License: GPL v3

Squalr Official Website

Join us on our Discord Channel

Squalr is performant Memory Editing software that allows users to create and share cheats in their windows desktop games. This includes memory scanning, pointers, x86/x64 assembly injection, and so on.

Squalr achieves fast scans through multi-threading combined with SIMD instructions. See this article: SIMD in .NET. To take advantage of these gains, your CPU needs to have support for SSE, AVX, or AVX-512.

SqualrGUI

Documentation

You can find detailed documentation on the Wiki. There are three ways to use Squalr:

  • Front end GUI
  • Scripting API
  • Back end NuGet packages

Below is some brief documentation on the NuGet package APIs

Receiving Engine Output:

If using the NuGet packages, it is important to hook into the engine's output to receive logs of events. These are invaluable for diagnosing issues.

using Squalr.Engine.Logging;

...

// Receive logs from the engine
Logger.Subscribe(new EngineLogEvents());

...

class EngineLogEvents : ILoggerObserver
{
	public void OnLogEvent(LogLevel logLevel, string message, string innerMessage)
	{
		Console.WriteLine(message);
		Console.WriteLine(innerMessage);
	}
}

Attaching The Engine

using Squalr.Engine.OS;
...

IEnumerable<Process> processes = Processes.Default.GetProcesses();

// Pick a process. For this example, we are just grabbing the first one.
Process process = processes.FirstOrDefault();

Processes.Default.OpenedProcess = process;

Manipulating Memory:

using Squalr.Engine.Memory;

...

Reader.Default.Read<Int32>(address);
Writer.Default.Write<Int32>(address);
Allocator.Alloc(address, 256);
IEnumerable<NormalizedRegion> regions = Query.GetVirtualPages(requiredProtection, excludedProtection, allowedTypes, startAddress, endAddress);
IEnumerable<NormalizedModule> modules = Query.GetModules();

Assembling/Disassembling:

Squalr can assemble and disassemble x86/x64 instructions, leveraging NASM.

using Squalr.Engine.Architecture;
using Squalr.Engine.Architecture.Assemblers;

...

// Perform assembly
AssemblerResult result = Assembler.Default.Assemble(assembly: "mov eax, 5", isProcess32Bit: true, baseAddress: 0x10000);

Console.WriteLine(BitConverter.ToString(result.Bytes).Replace("-", " "));

// Disassemble the result (we will get the same instructions back)
Instruction[] instructions = Disassembler.Default.Disassemble(bytes: result.Bytes, isProcess32Bit: true, baseAddress: 0x10000);

Console.WriteLine(instructions[0].Mnemonic);

Scanning:

Squalr has an API for performing high performance memory scanning:

using Squalr.Engine.Scanning;
using Squalr.Engine.Scanning.Scanners;
using Squalr.Engine.Scanning.Scanners.Constraints;
using Squalr.Engine.Scanning.Snapshots;

...

DataType dataType = DataType.Int32;

// Collect values
TrackableTask<Snapshot> valueCollectorTask = ValueCollector.CollectValues(
	SnapshotManager.GetSnapshot(Snapshot.SnapshotRetrievalMode.FromActiveSnapshotOrPrefilter, dataType));

// Perform manual scan on value collection complete
valueCollectorTask.CompletedCallback += ((completedValueCollection) =>
{
	Snapshot snapshot = completedValueCollection.Result;
	
	// Constraints
	ScanConstraintCollection scanConstraints = new ScanConstraintCollection();
	scanConstraints.AddConstraint(new ScanConstraint(ScanConstraint.ConstraintType.Equal, 25));

	TrackableTask<Snapshot> scanTask = ManualScanner.Scan(
		snapshot,
		allScanConstraints);

	SnapshotManager.SaveSnapshot(scanTask.Result);
});
	
	
for (UInt64 index = 0; index < snapshot.ElementCount; index++)
{
	SnapshotElementIndexer element = snapshot[index];

	Object currentValue = element.HasCurrentValue() ? element.LoadCurrentValue() : null;
	Object previousValue = element.HasPreviousValue() ? element.LoadPreviousValue() : null;
}

Debugging:

// Example: Tracing write events on a float
BreakpointSize size = Debugger.Default.SizeToBreakpointSize(sizeof(float));
CancellationTokenSource cancellationTokenSource = Debugger.Default.FindWhatWrites(0x10000, size, this.CodeTraceEvent);

...

// When finished, cancel the instruction collection
cancellationTokenSource.cancel();

...

private void CodeTraceEvent(CodeTraceInfo codeTraceInfo)
{
	Console.WriteLine(codeTraceInfo.Instruction.Address.ToString("X"));
	Console.WriteLine(codeTraceInfo.Instruction.Mnemonic);
}

Recommended Visual Studio Extensions

Reference Description
XAML Formatter XAML should be run through this formatter
StyleCop StyleCop to enforce code conventions. Note that we deviate on some standard conventions. We use the full type name for variables (ex Int32 rather than int). The reasoning is that this is a memory editor, so we prefer to use the type name that is most explicit to avoid coding mistakes.

Build

In order to compile Squalr, you should only need Visual Studio 2017. This should be up to date, we frequently update Squalr to use the latest version of the .NET framework. Here are the important 3rd party libraries that this project uses:

Library Description
EasyHook Managed/Unmanaged API Hooking
SharpDisasm Udis86 Assembler Ported to C#
CsScript C# Scripting Library
AvalonEdit Code Editing Library
SharpDX DirectX Wrapper
CLRMD .NET Application Inspection Library
AvalonDock Docking Library
LiveCharts WPF Charts

Planned Features

Library Description Purpose
AsmJit x86/x64 Assembler Replace FASM, improve scripting drastically
AsmJit x86/x64 Assembler Original C++ project. May port/interop this if the above version does not work (Neither may fully work, and something custom may be needed)
WpfHexEditorControl Hex Editor Hex editor / Memory Hex Editor
OpenTK OpenGL Wrapper Graphics Injection
SharpDX DirectX Wrapper Graphics Injection (Currently using SharpDX just for input)
SharpPCap Packet Capture Packet Editor
Packet.Net Packet Capture Packet Editor

squally's People

Contributors

mattbucci avatar shakeryounis avatar smotto avatar teknoman117 avatar zcanann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

squally's Issues

Inventory System: Combat GUI

This probably needs to be a little more lightweight than the in-game GUI version of this feature

The requirements here are really limited -- we only need the player to be able to bring up a menu of combat-consumable items (ie potions)

This might not even need a "real gui" -- we can likely just use the format being used to display attacks right now, without any francy menus. That is to say, we only need floating text and an icon. Nothing fancy.

Basic Enemy Combat AI

For now this just means "find a target and attack it", but will need to be extensible in the case where we want to handle healing/item usage. I'm not sure if enemies get to use items.

Projectile Collision

In combat, we are not using the collision system, as combat is 2.5D and our collision system does not support this. The only problem this creates is enitity <=> projectile collision, which needs to operate in 3d space. This can probably simply be done via distance check on a 3d sphere from the center of the entity.

Note that we CANNOT just 'fake' this system by making the damage automatic -- we want to allow for mechanics where the player "hacks" projectiles to change their behavior.

More Action-Platformer-esque Controls

I think a control system like Rougelands would work well.

Instead of facing the direction of movement, have the player face the direction of the mouse.

This will tie in well with out-of-combat weapon swinging/interaction, which will be captured in other tasks

Fast-Boot

Rightnow the Bootstrapper.cpp class pre-loads many scenes (menus, hexus, etc). These should be lazy-loaded so that the game can boot very quickly.

If the game crashes, this should be detected and the game should be able to quickly boot straight into the game (bypass title screen)

My guess is that this should be done via command line arguments to the game's executable (ie ./squally.exe fastboot), which the launcher should be able to pass

Combat Victory Events

When the player wins in combat, the following should happen:

  • Any custom events triggered (ie event that is triggered on the defeat of a boss). Be careful here, if the game crashes after the enemy dies but before this event is triggered, we don't want potential soft-locks.
  • Enemy death state saved (if this is permanent)
  • Items/rewards given to the user. This should probably be done while still on the combat scene.
  • The killed enemy should remain dead in the overworld, with their Dead animation played on NoRepeat.
  • The player should load back into the position they were in when the fight started.

Inventory System: Backend

  • OOP style Item inheritance class structure
  • The ability to filter based on item types
  • Stackables
  • Equippables
  • Consumables
  • Combat-only consumables
  • Out-of-combat-only consumables

Hackable Duration System

I just implemented a v1.0 version of this

Any hack should be temporary. The duration needs to be configurable -- some things make sense to have long durations, other things only short durations make sense

We currently need:

  • Offload hackable buttons / duration progress bars to a layer above the level at runtime. This will solve the following problems: 1) low Z-index on buttons/bars that get covered and 2) the buttons/bars currently can be rotated if the parent itself rotates, which is not ideal
  • Support multiple progress bars for multiple active hacks on the same object?
  • Show icons by the progress bars? The same icons in the radial menu

Figure out a UUID for Objects/Entities in Map Files

We need to be able to uniquely identify an object or entity

Best candidate so far is the Tiled "object ID", which is assigned to all objects.
<object id="452" name="squally" type="entity" x="1739.03" y="2719.39" width="78.7879" height="88"/>

This needs to be checked to make sure that it is resistant to file edits (ie all of the object IDs changing after a minor edit)

Keybind System

Need the following:

  • Default keybinds
  • Check keybinds instead of keycodes
  • Ability to reset keybinds to default

Note: There is no intention to support controllers given the need to code in this game, which would suck with a controller.

Hexus Tuning

  • Reward system sucks (lootboxes are garbage)
  • Enemy difficulty needs tuning based on data
  • There are too many enemies

Dynamic Combat Camera

The camera should dance around, shake, and all sorts of goodness.

This should also help us nail down a good camera API for the general gameplay as well.

Projectile-Spawn System

When an enemy throws a hand-held projectile*, the following events need to happen:

  • The projectile in the animation needs to disappear. This can likely be done by setting it's opacity to 0
  • An event is triggered requesting a game-object version of that projectile needs to be spawned in-game in the EXACT position/rotation/z-position of the despawned projectile to prevent visual breaks
  • The projectile needs to reappear in their hand (0 => 255 opacity over n seconds)

Ideally this would be generalized to minimize the amount of entity-specific code for each projectile.

  • Projectile is being used very generally here -- anything that can be thrown (an axe, torch, dynamite...)

Out-Of-Combat Weapon Swinging

Give the player the ability to use the item in their hand outside of combat.

This will allow us to do first-strike-advantage detection via the following steps:

  • Player clicks to swing their weapon
  • A collision box is enabled around the weapon
  • If this strikes an opponent, the fight starts w/ a player timeline advantage
  • Otherwise, the enemy gains the timeline advantage

Stats System

A bit ambiguous where this belongs, as it touches several systems

This should be very very very easy for us to manage. We might not even need classical stats. Just attack and defense may be adequate.

If we really cared enough to get fancy, we can shard these types (fire attack, fire resist) sort of thing.

It isn't really clear if we want "real stats" like str and dex, it seems overkill for what we need.

Extend InputText capabilities

InputText should be updated to support:

  • Support highlighting
  • Support ctrl+Z
  • Support click-to-move cursor positions

This should greatly improve the UX of editing code

User Request* : running a vim emulator within the cocos text buffer.

Error on Some Machines (Windows) Loading Pointer Trace Map Files

Sometimes the map in Pointer Trace fails to load tiles, only loading the objects in the map.

When speaking to a user, this only happened after first playing Story Mode, and then switching to Pointer Trace.

If the game is freshly launched, the map loads fine.

Friction Bug

Entities/player slide around when standing idle

Hexus Help Menus

We need help menus for all of the cards to give users an idea of how these cards work, and how binary operations work.

Perhaps these can be quasi-interactive to let users experiment with XOR/OR/ANDing different values

Hackable Symbol System

This is low priority as of when this issue was created


We need a symbol system to allow for users to use interesting variables in multiple places
Two options:

  1. A pre-set list of symbols (mouseX, mouseY, etc) that the users can use
  2. The ability to inspect data in the game and register any data as a symbol. Note that while many of these symbols will be dynamic addresses, we can always re-calculate them at runtime.
    2 Example) The player register's an enemy's X position as a symbol. In our backend we would need to track the UUID of that enemy. If that UUID currently exists, return the player's X position, otherwise the symbol is considered UNRESOLVED and returns nullptr.

Or some combination of 1 and 2 where there is a pre-set list as well as user-registerable symbols

Implement Cipher Minigame

Bad mockup:
cipher 1

In this mockup, the input 'sad' is being mapped to 'boy' via a simple cipher


The idea is that they can drag n' drop to build a cipher to map inputs to outputs.

The users solution is then run against a suite of inputs to determine if their solution is correct.

Some things to consider:

  • How to show multiple inputs + expected outputs to the user?
  • Constraints on how many components they can add? A budget perhaps? Or just leave this unbounded?
  • Conditionals? Probably not
  • How to display the ascii table in a non-intrusive way
  • Do we want to allow for a brute force mechanic?

Missing Resources

It's called UbuntuMono-Bold.ttf not UbuntuMono-B.ttf not sure about the others. How does this keep happening? do we have a rogue gitignore or something?

cocos2d: fullPathForFilename: No file found at /cc_2x2_white_image. Possible missing file.
cocos2d: fullPathForFilename: No file found at /__firePngData. Possible missing file.
cocos2d: fullPathForFilename: No file found at /__halfCircleImage. Possible missing file.
cocos2d: fullPathForFilename: No file found at /__bodyImage. Possible missing file.
cocos2d: fullPathForFilename: No file found at Fonts\UbuntuMono-B.ttf. Possible missing file.
warning: don't update it again
cocos2d: fullPathForFilename: No file found at Fonts\UbuntuMono-B.ttf. Possible missing file.
warning: don't update it again
cocos2d: fullPathForFilename: No file found at Fonts\UbuntuMono-B.ttf. Possible missing file.
cocos2d: fullPathForFilename: No file found at Fonts\UbuntuMono-B.ttf. Possible missing file.
cocos2d: fullPathForFilename: No file found at Fonts\UbuntuMono-B.ttf. Possible missing file.
cocos2d: fullPathForFilename: No file found at Fonts\UbuntuMono-B.ttf. Possible missing file.
cocos2d: fullPathForFilename: No file found at Fonts\UbuntuMono-B.ttf. Possible missing file.
cocos2d: fullPathForFilename: No file found at Fonts\UbuntuMono-B.ttf. Possible missing file.
cocos2d: fullPathForFilename: No file found at Fonts\UbuntuMono-B.ttf. Possible missing file.
cocos2d: fullPathForFilename: No file found at Fonts\UbuntuMono-B.ttf. Possible missing file.
cocos2d: fullPathForFilename: No file found at Fonts\UbuntuMono-B.ttf. Possible missing file.
cocos2d: fullPathForFilename: No file found at Fonts\UbuntuMono-B.ttf. Possible missing file.
cocos2d: fullPathForFilename: No file found at Fonts\UbuntuMono-B.ttf. Possible missing file.
cocos2d: fullPathForFilename: No file found at Fonts\UbuntuMono-B.ttf. Possible missing file.

Dark Lighting System

I think this makes some degree of sense to have a night-time Terraria-styled dark light mask over the level.

Considerations:

  • This should probably be made as an opacity-mask layer drawn above the level. Either we can make it exactly the same size as the screen and calculate the opacity mask on a per-update-loop basis, or we can make it the size of the level and do the same (possible performance issues with this route)
  • Should be an actual cocos node (SmartNode) rather than a post-process effect, as we will need the UI to be drawn above it.
  • There likely needs to be some sort of LightSource class in the Engine/ that defines the parameters for light. These params need to be tweakable by objects that inherit from it. (ie a torch that turns on and off or pulsates)

Alternatively we can go for some sort of crazy direction-based lighting system with objects that can occlude light sources. Honestly the trade-off here seems like "a shit ton more work for barely any benefit"

Possible minor performance hit in spriter ccimagefile.cpp

There seems to be constant sprite creation/destruction in this file.

This is in the update loop and not the draw loop, so it's fairly negligible.

Even if it doesn't affect performance, it makes debugging dispose methods (removing event listeners, children, etc) annoying because they're constantly being fired.


Proposed solution:

  • Create a mapping of: Sprite Path => Sprite Node
  • Check if map contains the sprite node we want. Create it if it doesn't exist.
  • Hide previous visible sprite node and show the new active sprite.

Fancy Lighting Sources

As the title suggests, I have no clue how this shit actually works

Google "Ori and the Blind Forest". They have cool looking colored lights. I suspect some shader work needs to be done to make these happen.

Inter-Map Traversal

Add the ability to move from one TMX map to another.

Ideally, this would be an object of type "portal", which the user can enter by pressing "W" (or their corresponding keybind)

This just needs to have a collision box that listens for player collision events to prompt the key press.

The keybind key should appear above the player as floating text, such that the user knows they can interact with the door.

ScrollPane Sucks Because ScrollView Sucks

Cocos has a horrible system in which scrollviews grow upwards instead of downwards. I did my best to "hide the bodies" with my ScrollPane class, but I couldn't get it entirely right.

This needs to be rewritten (actually this is fairly easy):

  • Use a ClippingRectangleNode to mask content that goes outside of the ScrollPane, with a plain Node class nested inside to hold the content.
  • Update CSlider and CProgressBar classes to support vertical orientation
  • Use this for the vertical scroll bar
  • Position the content node at the very top of the ClippingRectangle. This position can be considered 0.0f. Override addChild to calculate the lowest position of the content. This can be considered 1.0f

Now the callee just has to set the position of all children in the negatives the further down they go, but scrolling will start at the top, as expected

Fix the Shitty Player Controls

Squally's controls feel like underwater movement right now. It's really bad.

Also, his jump animation should cancel on collision with the ground

Generalize Navigation System God-Class

NavigationEvents has become a non-generalized god-class. This makes it really hard to extend and add new Scenes without having to touch 4+ different files.

This should be refactored to an interface that allows for something like:
NavigationEvents::Navigate<TitleScreen>();

NavigationEvents should then keep track of all scene instances and instantiate on the fly. This should greatly decrease game load time as well, as these are currently being loaded up-front.

Fight Should Have a Fade-In Animation

The screen should fade to black before the level loading begins, ideally with a pattern

See: https://youtu.be/nZKmDAbyRpk?t=17

Before combat begins there is an animation that last < 1s where the screen goes black in a diamond shape

Not sure how to tackle this one yet -- currently the loading of the CombatMap class is done in PlatformerMap.cpp.

Doing the transition in PlatformerMap might make sense

Cocos2d-x Sprite Culling Faulty

The math for culling sprites is wrong in cocos2d-x

Foreground objects close to the camera do not get properly culled, and this creates a jarring effect where sprites can pop out of existence.

Inventory System: Ingame GUI

Basically some sort of GUI for inventory system.

We decided infini-scrolling item lists is ideal, probably also with icons to make it look less drab

The equipment menu is going to be merged with this menu. A simple symbol indicating the item is equipped is sufficient

Fix x86/x64 Macros on OSX/Linux

These had to be patched on OSX to get it to compile, but I don't think the generated assembly was valid.

The mov reg, var and mov var, reg macros seem to be broken. These need fixing/testing on OSX/Linux

Hexus Improvements

These improvements are too big a time sink right now, but should be done eventually:

  • Enforce unique SFX for all cards. There are a couple duplicates.
  • Same goes for card FX
  • SFX for failing to kill a Binary0 card in StatePlayCard.cpp
  • SFX for coin flip
  • Row background effects. Useful when a card (ie SHL) is played to an empty row, and we still want some sort of visual. (Idea: maybe special row backgrounds in general?)
  • Add an indication if a card is "stolen" (not belonging to the original owner). There is already a flag in Card.h indicating this.
  • Some form of resignation without passing twice
  • Mismatch in row highlight vs board highlight style
  • SFX for stealing a card
  • SFX for spider card special
  • SFX for 'bonus moves' card
  • SFX for horde
  • The ability to show cards as Bin/Dec by holding Shift/Ctrl/Cmd/etc

Edit:
Finished or obsolete:

  • Put a marker over the panel of the next opponent/chapter. This helps clarify the situation where they have cleared up to the last enemy in a chapter, but have not yet defeated the last enemy
  • Animated background frames. These are currently static images, it would be much cooler if they were dynamic.

Create All Terrain Types

Currently only the castle ground terrain is implemented

There are still many other terrain types we need:

  • Snow
  • Grass (several variants)
  • Dirt (several variants)
  • Volcanic ground
  • Ruins
  • Something vapor-wavey for the final level (prolly need to hire an artist at this point)

Map Camera Hints

We need the ability for the game to signal hints to the camera.

For example, certain puzzles need a larger field of view, and thus it would be optimal for the camera to zoom out

My current thoughts are to place an object in the level, such that when the camera is within distance "X" of the object, it zooms out. The zoom factor can be a property on the object

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.