I want to make a procedurally generated virtualized drive - how can I do this? - storage

I've had the idea for a procedurally generated virtual drive bouncing around my head for a long time. It wouldn't really have any uses, and really it would just be for the memes, but I've finally settled down and decided to make it.
The idea is to make a fake drive that, whenever a program asks for a sector from, a bit of code will generate that sector on the fly (instead of reading it from a storage medium like a normal drive). Of course, writing to the disk would be impossible, but that's ok - I'm just doing this for fun.
Question is: how do I actually make this appear as a drive?
I should think there's a library out there somewhere that will let you directly, but I haven't been able to find it yet. I don't really know what keywords I should be searching for, either.
I have a lot of experience with Arduinos and hardware - would it be easier to simply connect the SPI pins to an SD card slot and get the Arduino to generate the "sectors"?
I'm thinking of using this to play around with file systems and ridiculously large files - after all, there is no limit to how big the drive can be (since it doesn't require any real memory), besides 32 bit or 64 bit limits, which could be a lot of fun - if only to pretend you have a zettabyte of disk space. Even though it would be read only, I'm curious how Notepad would handle a petabyte txt file.
If anyone has any ideas on how to do this, or knows some better keywords I can use to search for this, let me know!
(I am fairly fluent in Python, Arduino, and I can do a little C if I sit down with a coffee)

You didn't specify how you wanted to tackle this, but on Linux there's Fuse, the Filesystem in Userspace. It's a library that allows you to implement functions that handle the usual filestem operations, i.e. enumerating files and directories, opening files and reading/writing to them.
It also has a python wrapper and a tutorial.

Related

What takes up the majority of the storage space in video games?

I've been curious recently about why text/code seems to take up so little storage but videogame applications are enormous in size. For example, a game like Warzone is over 100 Gb.
Link to see how enormous the maps are: https://www.gamesatlas.com/cod-modern-warfare/guides/call-of-duty-warzone-map-all-cod-battle-royale-locations
I've done some research and think that it has something to do with the complex landscapes that are created in the videogames. Those don't seem to be lines of code that a developer has written but rather creating some sort of 3D environment for your game to run in.
What about something like Windows or other operating systems? Is there entire storage "weight" of what is downloaded code or data that is being downloaded as well to make the applications done?
If the majority of it is code, how do those enormous organizations write so many lines of code to take up so much storage?
It just depends on the game.
For triple A games, I woukd say most of it is binary data like texture, models, media (like video, cinematic, audio).
Then you have the way your game is packed and lot of dependencies like C Redistribuable, game engines, physics engine, libraries, etc ... While many of those are not used they may still be packed in the game.
For some "indie" games like Minecraft, I wouldn't be surprise code is what take most of the space (or Audio I guess ?). Note that the map can be larger than the game too ...
What you can do is use a tool like Windirstats to check what is happening, but It will not find dependencies that are out of the folder.
For the codebase, I guess its mainly automated through games engines.
Here is an example for Conan Exile :
So it's mainly texture data (GraniteSDK), the game engine files is 115MB and executable are 100MB (note that it has Battleye anti-cheat packed, + the server version of the game). Video is 500MO ...
Another example for Minecraft :
Which is (contrary to what I expected) mainly texture/sound data.
What about, let's say, Chrome ?
Interpretation : I have no clue :D.
Last one:
Python itself is not quite big. But all the dependencies, their dependencies (the dlls, etc) are quite big at the end.

how I can translate changes made in Cheat Engine into my game.exe

I have a game I am looking to modify a bit by altering the exe code, something I have a little bit of experience with (low level hacking HEX only as I do not have source code of game).
I found a trainer that writes into the game.exe memory to do things like increase health, money etc. The trainer itself can do many things, one of which is preventing enemies from dropping loot once they are killed. This is the function that I wish to embed in the game.exe.
I have found the address of this function in Cheat Engine and have successfully written new data into memory to prevent the look drops. Now my task is how to make this permanent in the game.exe?
Does anyone know how I can translate the changes I make in Cheat Engine into my game.exe so that I no longer need a trainer to make the changes?
Cheat engine does not, as far as I'm aware, have the capability to permanently patch the .exe file. To do this you will want to use OllyDbg which does allow it.
You have already found the address's you need in CE and you can use these in OllyDbg to go right to where you need to change stuff.

Importing or bypassing a complicated SDK

I'm writing a program (C#) to read, convert, display, adjust and output point cloud data.
I can make every part of the program except for one - I am required to read in a proprietary file format. The data is coming straight from a laser scanner and we cannot get any closer to the stream than what is output to the proprietary file in binary.
I have an SDK from the manufacturer/proprietor that is well outside my scope of ability to deal with.
Firstly it is written in C++, which I can read and write to some degree but this all appears incredibly complex (there are hundred of header/source files).
Secondly, the SDK documentation says that I must create my SLN using CMake which is a nightmare for me also.
Thirdly, the documentation is scarce and horrid.
Basically my question is this:
I know that after a certain amount of header information I should find thousands of lines of "lineref,x,y,z,r,g,b,time,intensity".
Can I bypass the SDK and find another way to read in this file type?
Or, must an SDK from the proprietor be used to interact with their file type due to some sort of encryption?

Is it possible to recover an iOS app from my iPhone?

I was halfway through developing an iOS app but have sadly lost the development files (it's a long story). I have the latest version still on my iPhone. Is there some way of recovering it or even just part of it for use in Xcode?
Thanks.
In theory you can decompile the binary, which should be backed up in your iTunes backup. It is not a simple process, and if you encrypted the binary you should maybe just give up. The result of the decompilation will be nothing like what you started with -- rather it will be a bunch of cryptic C functions that don't necessarily make sense but which will compile back to your app. You might get something usable. Assuming that you actually are able to decompile and rebuild your app, the challenge you will face is in the future -- maintaining/updating cryptic code.
So my advice is to check the possibility of local backups/checkins (as per other answers here). You might try undeleting the files from your hard drive (DON'T save any more files to your disk, just download undelete software and try it). Short of those things, you can take to heart the advice of my Comp Sci 101 professor. I quote:
Don't fret - it's always easier the second time around.
Good luck.
If you have Time machine enabled on your mac you may want to look in there. But other than that I don't think so.

how to prevent that the OS or other programs writes on a storage device in the same time as my program does

I'm a Delphi programmer.
I want to fill the entire free space of a storage device with dummy file(s).
During this operation I want to prevent that Windows or other programs write on the device.
I know it is doable because I have seen programs that do it.
I already have the code to create the dummy files (using TFileStream, very fast on NTFS) so all I need is some sort of lock/unlock code.
Does someone know a way..?
Thank you for any suggestion.
I will accept even solutions that will change the way I create those files, provided that the entire program will work better.
Thank you.
Best regards, John.
There's a SetEndOfFile function which is presumably transactional (i.e. it either succeeds or fails), which I think (I haven't tested/checked it) you can use to grow a file to fill available space.

Resources