Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ScienceDiscoverer committed Sep 22, 2023
1 parent a23fc1a commit 6b9b6ce
Show file tree
Hide file tree
Showing 3,737 changed files with 699,686 additions and 2 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.exe
*.dll
*.lib
*.obj
*.pdb
*.cod
*.res
*.exp

# Test Files Directory
tstf/
72 changes: 70 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,70 @@
# steamscrd
Powerfull Steam screenshot downloader. Supports restricted content and saves screenshot description/date into local JPG file.
# Steam Screenshot Downloader

[![GitHub release (with filter)](https://img.shields.io/github/v/release/ScienceDiscoverer/steamscrd)](../../releases/latest)
   ![GitHub all releases](https://img.shields.io/github/downloads/ScienceDiscoverer/steamscrd/total)
   [![Sponsor Badge](https://img.shields.io/badge/%E2%98%95_Sponsor-blue)](https://www.buymeacoffee.com/sciencediscoverer)

Download all the screenshots from a public steam profile. No sign-in required. Screenshot description and upload date are embedded directly into the `JPG` file, saved into separate folder for each game. Profanity filter and restricted content is not a problem for this tool.

![Program GIF demo](readme/steamscrd.gif)

## How to use

`steamscrd` supports both command line and direct user input interfaces.

### Command line

```
Usage: steamscrd [user_id] [options]
Options:
[-app=XXXX] --> game ID to download screenshots from
[-spage=XX] --> number of page to start download from
```

### Direct input

Launching `steamscrd` without any command line argument activates direct input interface. Just follow the instructions and type in or copy-paste your `ID` and any optional parameters, as needed. Then press `ENTER`.

## How to get `user ID` / `app ID`

`user ID` is a steam user's unique custom identifier. You can find it by visiting the profile page:

```
https://steamcommunity.com/id/[>>>sciencediscoverer<<<]
```
If said user never tried to set up a unique steam profile ID in the options, his/her profile address will look like this:

```
https://steamcommunity.com/profiles/[>>>765611980XXXXXXXX<<<]
```
You can use this number instead.

`app ID` is a steam game's unique identifier. You can get it from the game's store page:

```
https://store.steampowered.com/app/[>>>292030<<<]/_3/
```

## Tips

* You can pause download at any time by pressing `SPACE`. Unpause by pressing `SPACE` again.
* If you (for whatever reason) want to have all your screenshots in a single folder, instead of organised into separate folder for each game, you can use this `CMD` command to copy/move all images to a single folder: `for /r D:\<YOURID> %I in (*.jpg) do copy "%I" D:\ALL_SCREENS`.

## How to build

Just double-click the `msvc_build.cmd` file. Yep. As easy as this. Well, that is, if you have your Visual Studio installed, of course. And if your VS `vcvars64.bat` file is located at this path:

```
set "bat_dir=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
```
If not, first of all, make sure the [Visual Studio](https://visualstudio.microsoft.com/downloads/) is installed. In the setup wizard you will see a huge list of useless features and bloat. Only the C++ build tools are actually needed. Switch to `Individual components` and try to find this in the humongous list:

```
MSVC vXXX - VS 202X C++ x64/x86 build tools (Latest)
```

After this you will have to merely locate the `vcvars64.bat` file and copy-paste the path to it into `msvc_build.cmd`. Then just launch it and wait until it does all the job for you. Yes, you don't even need to install or open the Visual Studio IDE itself. Ever. I recommend you to try out my [Notepad++ C++ IDE](https://github.com/ScienceDiscoverer/npp_msvc_ide), if you like the idea of ditching the bloated, laggy and overengineered VS!

## Full video

[![Steam Screenshot Downloader Thumbnail](http://img.youtube.com/vi/uIicDGLsv4s/maxresdefault.jpg)](http://www.youtube.com/watch?v=uIicDGLsv4s "Steam Screenshot Downloader")
231 changes: 231 additions & 0 deletions lib/binf
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
#pragma once

#include <mmanip>

#include "types.h"

#define WIN32_LEAN_AND_MEAN
#include <windows.h>

#define EXCEPTION_BINF_OUT_OF_RANGE 0xE0000012

#ifndef ALL_ASSERT_OFF
#define BINF_ASSERT_RANGE(x) if((x) >= s){RaiseException(EXCEPTION_BINF_OUT_OF_RANGE, 0, 0, 0);}
#else
#define BINF_ASSERT_RANGE(x)
#endif

#define BINF_REALLOC_MULT 2
#define BINF_REALLOC_LIMIT 0x40000000 // 1'073'741'824 B
#define BINF_REALLOC_FIXED 0x6400000 // 104'857'600 B
#define BINF_GRANULARITY 0x10000 // 65'536 B
#define BINF_PAGE 0x1000 // 4'096 B

#define BINF_ALLOC_SZ(x) ((x) - (x) % BINF_PAGE + BINF_PAGE) // Always allocate exact amount of pages
#define BINF_ALLOC(x) (char *)VirtualAlloc(NULL, (x), MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE)
#define BINF_FREE VirtualFree(d, 0, MEM_RELEASE)

class binf
{
public:
binf();
binf(ui64 size);
binf(const binf &o) = delete;
binf(binf &&o) = delete;

~binf();

binf & operator=(const binf &o) = delete;
binf & operator=(binf &&o) = delete;
binf & operator=(ui64 ui);
binf & operator=(i64 i);
binf & operator=(i32 i);

char & operator[](ui64 i);
const char & operator[](ui64 i) const;

operator char *();
operator const char *() const;

ui64 operator~() const; // Size operator
ui64 operator!() const; // True Size Operator

binf & operator<<(char data);

binf & Add(const char *data, ui64 size);
binf & Clear();
binf & SetSize(ui64 sz);

private:
ui64 ts;
ui64 s;
char *d;
};

inline binf::binf()
{
ts = 0;
s = 0;
d = NULL;
}

inline binf::binf(ui64 size)
{
ts = BINF_ALLOC_SZ(size);
s = 0;
d = BINF_ALLOC(ts);
}

inline binf::~binf()
{
BINF_FREE;
}

inline binf & binf::operator=(ui64 ui)
{
if(ts <= ui)
{
BINF_FREE;
ts = BINF_ALLOC_SZ(ui);
d = BINF_ALLOC(ts);
}

s = 0;
return *this;
}

inline binf & binf::operator=(i64 i)
{
if((i64)ts <= i)
{
BINF_FREE;
ts = BINF_ALLOC_SZ(i);
d = BINF_ALLOC(ts);
}

s = 0;
return *this;
}

inline binf & binf::operator=(i32 i)
{
if((i32)ts <= i)
{
BINF_FREE;
ts = BINF_ALLOC_SZ(i);
d = BINF_ALLOC(ts);
}

s = 0;
return *this;
}

inline char & binf::operator[](ui64 i)
{
BINF_ASSERT_RANGE(i)
return d[i];
}

inline const char & binf::operator[](ui64 i) const
{
BINF_ASSERT_RANGE(i)
return d[i];
}

inline binf::operator char *()
{
return d;
}

inline binf::operator const char *() const
{
return (const char *)d;
}

inline ui64 binf::operator~() const
{
return s;
}

inline ui64 binf::operator!() const
{
return ts;
}

inline binf & binf::operator<<(char data)
{
ui64 ns = s + 1;
if(ts < ns)
{
char *tmp;
if(d == NULL) // First allocation
{
ts = BINF_PAGE;
tmp = BINF_ALLOC(ts);
}
else
{
ui64 nts = ts * BINF_REALLOC_MULT;
ts = nts > BINF_REALLOC_LIMIT ? ts + BINF_REALLOC_FIXED : nts;
tmp = BINF_ALLOC(ts);
mcpy(tmp, d, s);
BINF_FREE;
}
d = tmp;
}

d[s] = data;
s = ns;

return *this;
}

inline binf & binf::Add(const char *data, ui64 size)
{
ui64 ns = s + size;
if(ts < ns)
{
char *tmp;
ts = BINF_ALLOC_SZ(ns);
if(d == NULL) // First allocation
{
tmp = BINF_ALLOC(ts);
}
else
{
ui64 nts = ts * BINF_REALLOC_MULT;
ts = nts > BINF_REALLOC_LIMIT ? ts + BINF_REALLOC_FIXED : nts;
tmp = BINF_ALLOC(ts);
mcpy(tmp, d, s);
BINF_FREE;
}
d = tmp;
}

mcpy(d+s, data, size);
s = ns;

return *this;
}

inline binf & binf::Clear()
{
s = 0;
return *this;
}

inline binf & binf::SetSize(ui64 sz)
{
s = sz;
return *this;
}




//binf & SetInternalVals(ui64 trues, ui64 sz, char *data);
//inline binf & binf::SetInternalVals(ui64 trues, ui64 sz, char *data)
//{
// ts = trues, s = sz, d = data;
// return *this;
//}
47 changes: 47 additions & 0 deletions lib/conint
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#pragma once
#include <stdp>

inline void printProgBar(ui64 max, ui64 cur, ui64 x, ui64 y, ui64 len)
{
if(len == 0)
{
len = 100;
}

HANDLE oh = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD attr_wr;
COORD pos;
pos.X = (SHORT)x;
pos.Y = (SHORT)y;
// BLUE 0x90 --> BACKGROUND_INTENSITY | BACKGROUND_BLUE
// DARKBLUE 0x10 --> BACKGROUND_BLUE
// DARKGRAY 0x80 --> BACKGROUND_INTENSITY
WORD blue = 0x10, dgray = 0x80;

ui64 full = (ui64)((float)cur/(float)max * (float)len);
ui64 empty = len - full;

COORD empty_pos = pos;
empty_pos.X += (SHORT)full;

FillConsoleOutputAttribute(oh, blue, (DWORD)full, pos, &attr_wr);
FillConsoleOutputAttribute(oh, dgray, (DWORD)empty, empty_pos, &attr_wr);

txt prog = i2t(cur) + '/' + i2t(max);
COORD prog_pos = pos;
prog_pos.X += (WORD)len + 1;

for(ui64 i = 0; i < ~prog; ++i)
{
FillConsoleOutputCharacter(oh, prog[i], 1, prog_pos, &attr_wr);
++prog_pos.X;
}
}

inline void printProgBarMod(ui64 mod, ui64 max, ui64 cur, ui64 x, ui64 y, ui64 len)
{
if(cur % mod == 0)
{
printProgBar(max, cur, x, y, len);
}
}
14 changes: 14 additions & 0 deletions lib/curl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#define CURL_STATICLIB
#include "ext/curl/curl.h"

#ifdef _DEBUG
#pragma comment( lib, "ext/curl/libcurl_a_debug" )
#else
#pragma comment( lib, "ext/curl/libcurl_a" )
#endif

#pragma comment( lib, "Normaliz" )
#pragma comment( lib, "ws2_32" )
#pragma comment( lib, "wldap32" )
#pragma comment( lib, "crypt32" )
#pragma comment( lib, "advapi32" )
Loading

0 comments on commit 6b9b6ce

Please sign in to comment.