Compare commits
No commits in common. "master" and "1.2.2" have entirely different histories.
33
.drone.yml
33
.drone.yml
@ -7,34 +7,5 @@ steps:
|
||||
image: maven:3-amazoncorretto-8
|
||||
commands:
|
||||
- mvn install
|
||||
- name: gitea_release
|
||||
image: plugins/gitea-release
|
||||
settings:
|
||||
api_key:
|
||||
from_secret: gitea_token
|
||||
base_url: https://git.jeddunk.xyz
|
||||
files:
|
||||
- auto-cream-api-*.zip
|
||||
checksum:
|
||||
- md5
|
||||
- sha1
|
||||
- sha256
|
||||
- sha512
|
||||
- adler32
|
||||
- crc32
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
- name: discord_webhook
|
||||
image: appleboy/drone-discord
|
||||
settings:
|
||||
webhook_id:
|
||||
from_secret: discord_webhook_id
|
||||
webhook_token:
|
||||
from_secret: discord_webhook_token
|
||||
message: >
|
||||
{{#success build.status}}
|
||||
build {{build.number}} succeeded.
|
||||
{{else}}
|
||||
build {{build.number}} failed.
|
||||
{{/success}}
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
<component name="ProjectKey">
|
||||
<option name="state" value="project://e79810c8-c5c8-43b1-b19c-90c1f4095425" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8 (amazon)" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
@ -1,8 +1,5 @@
|
||||
# Auto-CreamAPI
|
||||
|
||||
## Development is continuing [here](https://git.jeddunk.xyz/jeddunk/auto-creamapi-2)! However you're still welcome to use this version.
|
||||
|
||||
[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/H2H4330U3)
|
||||
[![Build Status](https://ci.jeddunk.xyz/api/badges/jeddunk/auto-cream-api/status.svg)](https://ci.jeddunk.xyz/jeddunk/auto-cream-api)
|
||||
|
||||
Set your game automatically up for use with CreamAPI.
|
||||
|
2
pom.xml
2
pom.xml
@ -110,7 +110,7 @@
|
||||
<destinationFile>${dist}/steam_api.dll</destinationFile>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<sourceFile>${project.basedir}/steam_api64.dll</sourceFile>
|
||||
<sourceFile>${project.basedir}/steam_api.dll</sourceFile>
|
||||
<destinationFile>${dist}/steam_api64.dll</destinationFile>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
|
@ -144,24 +144,12 @@ public class Controller implements Initializable {
|
||||
language_combobox.setTooltip(new Tooltip());
|
||||
language_combobox.setEditable(false);
|
||||
new ComboBoxAutoComplete<>(language_combobox);
|
||||
dlc_textarea.setPromptText("List of DLC...\r0000 = DLC Name");
|
||||
generate_tooltips();
|
||||
fix_dlc_textarea_prompt_text();
|
||||
reset(true);
|
||||
state_label.setText("Ready.");
|
||||
}
|
||||
|
||||
private void generate_tooltips() {
|
||||
Tooltip extra_protection_tooltip = new Tooltip("\"extra protection\"");
|
||||
extra_protection_checkbox.setTooltip(extra_protection_tooltip);
|
||||
Tooltip.install(extra_protection_checkbox, extra_protection_tooltip);
|
||||
|
||||
Tooltip steamdb_dlc_tooltip = new Tooltip("Additionally get DLC data from SteamDB.\n" +
|
||||
"Especially useful for DLC that is not listed on the Steam Store.\n" +
|
||||
"This sometimes doesn't work because SteamDB may block access for scrapers.");
|
||||
steamdb_dlc_checkbox.setTooltip(steamdb_dlc_tooltip);
|
||||
Tooltip.install(steamdb_dlc_checkbox, steamdb_dlc_tooltip);
|
||||
}
|
||||
|
||||
private void read() {
|
||||
language_combobox.getSelectionModel().select(config.getLanguage());
|
||||
appId_textfield.setText(config.getAppId().toString());
|
||||
@ -185,6 +173,22 @@ public class Controller implements Initializable {
|
||||
unlockAll_disableDlcTextArea();
|
||||
}
|
||||
|
||||
private void fix_dlc_textarea_prompt_text() {
|
||||
dlc_textarea.setPromptText("List of DLC...\r0000 = DLC Name");
|
||||
}
|
||||
|
||||
private void generate_tooltips() {
|
||||
Tooltip extra_protection_tooltip = new Tooltip("\"extra protection\"");
|
||||
extra_protection_checkbox.setTooltip(extra_protection_tooltip);
|
||||
Tooltip.install(extra_protection_checkbox, extra_protection_tooltip);
|
||||
|
||||
Tooltip steamdb_dlc_tooltip = new Tooltip("Additionally get DLC data from SteamDB.\n" +
|
||||
"Especially useful for DLC that is not listed on the Steam Store.\n" +
|
||||
"This sometimes doesn't work because SteamDB may block access for scrapers.");
|
||||
steamdb_dlc_checkbox.setTooltip(steamdb_dlc_tooltip);
|
||||
Tooltip.install(steamdb_dlc_checkbox, steamdb_dlc_tooltip);
|
||||
}
|
||||
|
||||
private ChangeListener<String> appIdChangesGameName() {
|
||||
return (observable, oldValue, newValue) -> {
|
||||
int appId;
|
||||
@ -263,7 +267,47 @@ public class Controller implements Initializable {
|
||||
}
|
||||
|
||||
public void save() {
|
||||
saveService().start();
|
||||
Service<Void> s = new Service<Void>() {
|
||||
@Override
|
||||
protected Task<Void> createTask() {
|
||||
return new Task<Void>() {
|
||||
@Override
|
||||
protected Void call() {
|
||||
try {
|
||||
setUpCreamApi();
|
||||
config.setDlcListFromString(dlc_textarea.getText());
|
||||
config.setAppId(Integer.parseInt(appId_textfield.getText()));
|
||||
config.setExtraProtection(extra_protection_checkbox.isSelected());
|
||||
config.setForceOffline(offline_checkbox.isSelected());
|
||||
config.setUnlockAll(unlock_all_checkbox.isSelected());
|
||||
config.setLanguage(language_combobox.getValue());
|
||||
config.sync();
|
||||
} catch (IOException | ConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
cancel();
|
||||
} catch (NullPointerException e) {
|
||||
logger.warn("No configuration file set!");
|
||||
cancel();
|
||||
}
|
||||
updateIndicators();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
s.setOnRunning(event -> {
|
||||
setDisableAllButtons(true);
|
||||
state_label.setText("Saving...");
|
||||
});
|
||||
s.setOnSucceeded(event -> {
|
||||
setDisableAllButtons(false);
|
||||
state_label.setText("Saved successfully!");
|
||||
});
|
||||
s.setOnCancelled(event -> {
|
||||
setDisableAllButtons(false);
|
||||
state_label.setText("Could not save configuration file!");
|
||||
});
|
||||
s.start();
|
||||
}
|
||||
|
||||
public void getAppId() {
|
||||
@ -308,143 +352,6 @@ public class Controller implements Initializable {
|
||||
* also lists DLC not available for purchase.
|
||||
*/
|
||||
public void getDlcList() {
|
||||
getDlcListService().start();
|
||||
}
|
||||
|
||||
public void openFileChooser() {
|
||||
FileChooser chooser = new FileChooser();
|
||||
chooser.setTitle("Choose steam_api(64).dll...");
|
||||
FileChooser.ExtensionFilter filter =
|
||||
new FileChooser.ExtensionFilter("Steam API DLL",
|
||||
"steam_api.dll", "steam_api64.dll");
|
||||
chooser.getExtensionFilters().add(filter);
|
||||
File file = chooser.showOpenDialog(path_button.getScene().getWindow());
|
||||
try {
|
||||
config.setConfig(file.getParent() + "\\cream_api.ini");
|
||||
path_textfield.setText(file.getParent());
|
||||
steamApiPathString = file.getAbsolutePath();
|
||||
} catch (ConfigurationException | IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NullPointerException e) {
|
||||
logger.warn("Could not set config file location! Did you cancel the file chooser?");
|
||||
}
|
||||
emptyFields();
|
||||
reset(true);
|
||||
logger.info("File chosen: " + steamApiPathString);
|
||||
logger.info("Ready.");
|
||||
state_label.setText("Ready.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if CreamAPI version of DLL is there, if not, rename original to steam_api(64)_o.dll and copy
|
||||
* CreamAPI DLL to the path. Also looks for alternative Steam DLL (which means it patches both 64 and 32 bit
|
||||
* DLLs at once if found)
|
||||
*
|
||||
* @throws IOException If file is missing or not accessible/modifiable.
|
||||
*/
|
||||
private void setUpCreamApi() throws IOException {
|
||||
logger.info("Setting up DLL...");
|
||||
Path path = Paths.get(steamApiPathString);
|
||||
copyDllFile(path, isSameFile);
|
||||
findAdditionalDll(path);
|
||||
logger.info("Set up DLL successfully!");
|
||||
}
|
||||
|
||||
private void findAdditionalDll(Path path) throws IOException {
|
||||
String aDllString = is64Bit ? "\\steam_api.dll" : "\\steam_api64.dll";
|
||||
Path dir = path.getParent();
|
||||
Path aDll = Paths.get(dir.toString() + aDllString);
|
||||
if (Files.exists(aDll)) {
|
||||
logger.info("Additional DLL found: (" + aDll.toString() + ")!");
|
||||
InputStream is = Files.newInputStream(aDll);
|
||||
String md5 = DigestUtils.md5Hex(is);
|
||||
boolean aIsSameFile = Objects.equals(md5, handler.getDllMd5(!is64Bit));
|
||||
copyDllFile(aDll, aIsSameFile);
|
||||
}
|
||||
}
|
||||
|
||||
private void copyDllFile(Path path, boolean isSameFile) throws IOException {
|
||||
if (!isSameFile) {
|
||||
String pathOrigString = steamApiPathString;
|
||||
String replacement = is64Bit ? "steam_api64_o.dll" : "steam_api_o.dll";
|
||||
pathOrigString =
|
||||
pathOrigString
|
||||
.replaceFirst(REGEX, replacement);
|
||||
Path pathOrig = Paths.get(pathOrigString);
|
||||
if (!Files.exists(pathOrig)) {
|
||||
logger.info("Renaming " + path.toString() + " to " + replacement + "...");
|
||||
Files.move(path, pathOrig);
|
||||
} else {
|
||||
logger.info(pathOrigString + " already exists!");
|
||||
String pathBakString = steamApiPathString;
|
||||
pathBakString =
|
||||
pathBakString
|
||||
.replaceFirst(REGEX, is64Bit ? "steam_api64.dll.backup" : "steam_api.dll.backup");
|
||||
Path pathBak = Paths.get(pathBakString);
|
||||
Files.move(path, pathBak, StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
logger.info("Copying CreamAPI DLL to " + path.toString() + " ...");
|
||||
Files.copy(handler.getDllPath(is64Bit), path);
|
||||
}
|
||||
}
|
||||
|
||||
private void setDisableAllButtons(boolean b) {
|
||||
reset_button.setDisable(b);
|
||||
save_button.setDisable(b);
|
||||
getAppId_button.setDisable(b);
|
||||
path_button.setDisable(b);
|
||||
getDlcList_button.setDisable(b);
|
||||
}
|
||||
|
||||
public void resetFromButton() {
|
||||
reset(false);
|
||||
}
|
||||
|
||||
private Service<Void> saveService() {
|
||||
Service<Void> s = new Service<Void>() {
|
||||
@Override
|
||||
protected Task<Void> createTask() {
|
||||
return new Task<Void>() {
|
||||
@Override
|
||||
protected Void call() {
|
||||
try {
|
||||
setUpCreamApi();
|
||||
config.setDlcListFromString(dlc_textarea.getText());
|
||||
config.setAppId(Integer.parseInt(appId_textfield.getText()));
|
||||
config.setExtraProtection(extra_protection_checkbox.isSelected());
|
||||
config.setForceOffline(offline_checkbox.isSelected());
|
||||
config.setUnlockAll(unlock_all_checkbox.isSelected());
|
||||
config.setLanguage(language_combobox.getValue());
|
||||
config.sync();
|
||||
} catch (IOException | ConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
cancel();
|
||||
} catch (NullPointerException e) {
|
||||
logger.warn("No configuration file set!");
|
||||
cancel();
|
||||
}
|
||||
updateIndicators();
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
s.setOnRunning(event -> {
|
||||
setDisableAllButtons(true);
|
||||
state_label.setText("Saving...");
|
||||
});
|
||||
s.setOnSucceeded(event -> {
|
||||
setDisableAllButtons(false);
|
||||
state_label.setText("Saved successfully!");
|
||||
});
|
||||
s.setOnCancelled(event -> {
|
||||
setDisableAllButtons(false);
|
||||
state_label.setText("Could not save configuration file!");
|
||||
});
|
||||
return s;
|
||||
}
|
||||
|
||||
private Service<Void> getDlcListService() {
|
||||
Service<Void> s = new Service<Void>() {
|
||||
@Override
|
||||
protected Task<Void> createTask() {
|
||||
@ -473,7 +380,90 @@ public class Controller implements Initializable {
|
||||
setDisableAllButtons(false);
|
||||
state_label.setText("Could not get list of DLCs!");
|
||||
});
|
||||
return s;
|
||||
s.start();
|
||||
}
|
||||
|
||||
public void openFileChooser() {
|
||||
FileChooser chooser = new FileChooser();
|
||||
chooser.setTitle("Choose steam_api(64).dll...");
|
||||
FileChooser.ExtensionFilter filter =
|
||||
new FileChooser.ExtensionFilter("Steam API DLL",
|
||||
"steam_api.dll", "steam_api64.dll");
|
||||
chooser.getExtensionFilters().add(filter);
|
||||
File file = chooser.showOpenDialog(path_button.getScene().getWindow());
|
||||
try {
|
||||
config.setConfig(file.getParent() + "\\cream_api.ini");
|
||||
path_textfield.setText(file.getParent());
|
||||
steamApiPathString = file.getAbsolutePath();
|
||||
} catch (ConfigurationException | IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NullPointerException e) {
|
||||
logger.warn("Could not set config file location! Did you cancel the file chooser?");
|
||||
}
|
||||
emptyFields();
|
||||
reset(true);
|
||||
state_label.setText("Ready.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if CreamAPI version of DLL is there, if not, rename original to steam_api(64)_o.dll and copy
|
||||
* CreamAPI DLL to the path. Also looks for alternative Steam DLL (which means it patches both 64 and 32 bit
|
||||
* DLLs at once if found)
|
||||
*
|
||||
* @throws IOException If file is missing or not accessible/modifiable.
|
||||
*/
|
||||
private void setUpCreamApi() throws IOException {
|
||||
Path path = Paths.get(steamApiPathString);
|
||||
copyDllFile(path, isSameFile);
|
||||
findAdditionalDll(path);
|
||||
}
|
||||
|
||||
private void findAdditionalDll(Path path) throws IOException {
|
||||
String secondDllString = is64Bit ? "\\steam_api.dll" : "\\steam_api64.dll";
|
||||
Path dir = path.getParent();
|
||||
Path secondDll = Paths.get(dir.toString() + secondDllString);
|
||||
if (Files.exists(secondDll)) {
|
||||
//System.out.println("Alternative DLL found!");
|
||||
logger.info("Second DLL found: (" + secondDll.toString() + ")!");
|
||||
InputStream is = Files.newInputStream(secondDll);
|
||||
String md5 = DigestUtils.md5Hex(is);
|
||||
boolean isSameFile1 = Objects.equals(md5, handler.getDllMd5(!is64Bit));
|
||||
copyDllFile(secondDll, isSameFile1);
|
||||
}
|
||||
}
|
||||
|
||||
private void copyDllFile(Path path, boolean isSameFile) throws IOException {
|
||||
if (!isSameFile) {
|
||||
String pathOrigString = steamApiPathString;
|
||||
pathOrigString =
|
||||
pathOrigString
|
||||
.replaceFirst(REGEX, is64Bit ? "steam_api64_o.dll" : "steam_api_o.dll");
|
||||
Path pathOrig = Paths.get(pathOrigString);
|
||||
if (!Files.exists(pathOrig)) {
|
||||
Files.move(path, pathOrig);
|
||||
} else {
|
||||
String pathBakString = steamApiPathString;
|
||||
pathBakString =
|
||||
pathBakString
|
||||
.replaceFirst(REGEX, is64Bit ? "steam_api64.dll.backup" : "steam_api.dll.backup");
|
||||
Path pathBak = Paths.get(pathBakString);
|
||||
Files.move(path, pathBak, StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
//Files.deleteIfExists(path);
|
||||
Files.copy(handler.getDllPath(is64Bit), path);
|
||||
}
|
||||
}
|
||||
|
||||
private void setDisableAllButtons(boolean b) {
|
||||
reset_button.setDisable(b);
|
||||
save_button.setDisable(b);
|
||||
getAppId_button.setDisable(b);
|
||||
path_button.setDisable(b);
|
||||
getDlcList_button.setDisable(b);
|
||||
}
|
||||
|
||||
public void resetFromButton() {
|
||||
reset(false);
|
||||
}
|
||||
|
||||
static class ComboBoxAutoComplete<T> {
|
||||
|
@ -54,7 +54,7 @@ public class CreamApiConfig {
|
||||
config = CONFIGS.ini(path);
|
||||
config.setCommentLeadingCharsUsedInInput(";");
|
||||
} catch (ConfigurationException e) {
|
||||
logger.warn("No config file found!");
|
||||
logger.warn("No config file found in default location!");
|
||||
//e.printStackTrace();
|
||||
}
|
||||
|
||||
@ -109,7 +109,6 @@ public class CreamApiConfig {
|
||||
}
|
||||
|
||||
public void read() throws NullPointerException, NoSuchElementException {
|
||||
logger.info("Reading config file...");
|
||||
appId = config.getInt("steam.appid");
|
||||
language = config.getString("steam.language");
|
||||
if (language == null) {
|
||||
@ -120,11 +119,9 @@ public class CreamApiConfig {
|
||||
forceOffline = config.getBoolean("steam.forceoffline");
|
||||
final SubnodeConfiguration dlc_section = config.getSection("dlc");
|
||||
dlc_section.getKeys().forEachRemaining(k -> dlc.put(Integer.parseInt(k), dlc_section.getString(k)));
|
||||
logger.info("Successfully read config file!");
|
||||
}
|
||||
|
||||
public void sync() throws ConfigurationException {
|
||||
logger.info("Saving config file...");
|
||||
FileBasedConfigurationBuilder<INIConfiguration> builder = CONFIGS.iniBuilder(path);
|
||||
config = builder.getConfiguration();
|
||||
config.setCommentLeadingCharsUsedInInput(";");
|
||||
@ -145,7 +142,6 @@ public class CreamApiConfig {
|
||||
config.setProperty("steam_misc.disableuserinterface", false);
|
||||
|
||||
builder.save();
|
||||
logger.info("Saved successfully!");
|
||||
}
|
||||
|
||||
// DLC list parsing
|
||||
|
Loading…
Reference in New Issue
Block a user