Skip to content

Commit

Permalink
adjustments to latest version of AST (using external cminpack DLL) (#251
Browse files Browse the repository at this point in the history
)

* adjustments to latest version of AST (using external cminpack DLL)

* overrides NCP projections with SIN as a workaround for dodgy FITS headers
  • Loading branch information
veggiesaurus authored Dec 21, 2021
1 parent 6947612 commit 43e4a31
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 6 deletions.
40 changes: 39 additions & 1 deletion ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ PlayerSettings:
androidRenderOutsideSafeArea: 1
androidUseSwappy: 0
androidBlitType: 0
androidResizableWindow: 0
androidDefaultWindowWidth: 1920
androidDefaultWindowHeight: 1080
androidMinimumWindowWidth: 400
androidMinimumWindowHeight: 300
androidFullscreenMode: 1
defaultIsNativeResolution: 1
macRetinaSupport: 1
runInBackground: 1
Expand Down Expand Up @@ -127,7 +133,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
bundleVersion: 1.0-beta.5
bundleVersion: 1.0-beta.6
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
Expand Down Expand Up @@ -372,6 +378,7 @@ PlayerSettings:
switchPublisherNames_12:
switchPublisherNames_13:
switchPublisherNames_14:
switchPublisherNames_15:
switchIcons_0: {fileID: 0}
switchIcons_1: {fileID: 0}
switchIcons_2: {fileID: 0}
Expand All @@ -387,6 +394,7 @@ PlayerSettings:
switchIcons_12: {fileID: 0}
switchIcons_13: {fileID: 0}
switchIcons_14: {fileID: 0}
switchIcons_15: {fileID: 0}
switchSmallIcons_0: {fileID: 0}
switchSmallIcons_1: {fileID: 0}
switchSmallIcons_2: {fileID: 0}
Expand All @@ -402,6 +410,7 @@ PlayerSettings:
switchSmallIcons_12: {fileID: 0}
switchSmallIcons_13: {fileID: 0}
switchSmallIcons_14: {fileID: 0}
switchSmallIcons_15: {fileID: 0}
switchManualHTML:
switchAccessibleURLs:
switchLegalInformation:
Expand Down Expand Up @@ -464,6 +473,8 @@ PlayerSettings:
switchSocketInitializeEnabled: 1
switchNetworkInterfaceManagerInitializeEnabled: 1
switchPlayerConnectionEnabled: 1
switchUseMicroSleepForYield: 1
switchMicroSleepForYieldTime: 25
ps4NPAgeRating: 12
ps4NPTitleSecret:
ps4NPTrophyPackPath:
Expand Down Expand Up @@ -534,10 +545,36 @@ PlayerSettings:
ps4videoRecordingFeaturesUsed: 0
ps4contentSearchFeaturesUsed: 0
ps4CompatibilityPS5: 0
ps4AllowPS5Detection: 0
ps4GPU800MHz: 1
ps4attribEyeToEyeDistanceSettingVR: 0
ps4IncludedModules: []
ps4attribVROutputEnabled: 0
ps5ParamFilePath:
ps5VideoOutPixelFormat: 0
ps5VideoOutInitialWidth: 1920
ps5VideoOutOutputMode: 1
ps5BackgroundImagePath:
ps5StartupImagePath:
ps5Pic2Path:
ps5StartupImagesFolder:
ps5IconImagesFolder:
ps5SaveDataImagePath:
ps5SdkOverride:
ps5BGMPath:
ps5ShareOverlayImagePath:
ps5NPConfigZipPath:
ps5Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ
ps5UseResolutionFallback: 0
ps5UseAudio3dBackend: 0
ps5ScriptOptimizationLevel: 2
ps5Audio3dVirtualSpeakerCount: 14
ps5UpdateReferencePackage:
ps5disableAutoHideSplash: 0
ps5OperatingSystemCanDisableSplashScreen: 0
ps5IncludedModules: []
ps5SharedBinaryContentLabels: []
ps5SharedBinarySystemFolders: []
monoEnv:
splashScreenBackgroundSourceLandscape: {fileID: 0}
splashScreenBackgroundSourcePortrait: {fileID: 0}
Expand All @@ -564,6 +601,7 @@ PlayerSettings:
il2cppCompilerConfiguration: {}
managedStrippingLevel: {}
incrementalIl2cppBuild: {}
suppressCommonWarnings: 1
allowUnsafeCode: 1
additionalIl2CppArgs:
scriptingRuntimeVersion: 1
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ No datasets are currently packaged with the repo, to keep the size down to a min
### Building plugins
You will need to download and install [vcpkg](https://github.com/microsoft/vcpkg) and [CMake](https://cmake.org/download/). Follow the install instructions and ensure you can run `vcpkg` and `cmake` from the commandline (or powershell). You may need to add folders to your PATH environmental variable.

**NOTE**: for now, we have to use a PR [branch](https://github.com/veggiesaurus/vcpkg/tree/veggiesaurus/starlink_ast_cminpack_fix) of vcpkg!

Install dependencies using vcpkg:
```powershell
vcpkg install starlink-ast:x64-windows cfitsio:x64-windows
Expand Down
5 changes: 4 additions & 1 deletion native_plugins_cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ ENDIF ()

include_directories(${CFITSIO_INCLUDE_DIR})

find_package(cminpack CONFIG REQUIRED)

find_path(AST_INCLUDE_DIR ast.h)
find_library(AST_LIB_PATH ast)
get_filename_component(AST_LIB_DIR ${AST_LIB_PATH} DIRECTORY)
Expand All @@ -36,9 +38,10 @@ SET(CMAKE_FIND_LIBRARY_PREFIXES "")
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dll")
find_library(CFITSIO_RUNTIME "cfitsio")
find_library(ZLIB_RUNTIME "zlib1")
find_library(CMINPACK_RUNTIME "cminpack")

install(TARGETS fits_reader data_analysis_tool ast_tool
RUNTIME
DESTINATION ${PROJECT_SOURCE_DIR}/../Assets/Plugins
)
install(FILES ${CFITSIO_RUNTIME} ${ZLIB_RUNTIME} DESTINATION ${PROJECT_SOURCE_DIR}/../Assets/Plugins)
install(FILES ${CFITSIO_RUNTIME} ${ZLIB_RUNTIME} ${CMINPACK_RUNTIME} DESTINATION ${PROJECT_SOURCE_DIR}/../Assets/Plugins)
2 changes: 1 addition & 1 deletion native_plugins_cmake/ast_tool/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
add_library(ast_tool SHARED ast_tool.cpp ast_tool.h)
target_link_libraries(ast_tool cfitsio ast ast_err ast_pal ast_grf_5.6 ast_grf_3.2 ast_grf_2.0 ast_grf3d)
target_link_libraries(ast_tool cfitsio cminpack::cminpack ast ast_err ast_pal ast_grf_5.6 ast_grf_3.2 ast_grf_2.0 ast_grf3d)
30 changes: 29 additions & 1 deletion native_plugins_cmake/ast_tool/ast_tool.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
#include "ast_tool.h"

#include <string>

// Adapted from https://stackoverflow.com/a/29752943
void ReplaceAll(std::string &source, std::string &currentSubstring, const std::string &newSubstring) {
std::string dest;
dest.reserve(source.length());

std::string::size_type lastPos = 0;
std::string::size_type findPos;

while (std::string::npos != (findPos = source.find(currentSubstring, lastPos))) {
dest.append(source, lastPos, findPos - lastPos);
dest += newSubstring;
lastPos = findPos + currentSubstring.length();
}
dest += source.substr(lastPos);
source.swap(dest);
}

void ReplaceAll(std::string &source, const char* currentSubstring, const char* newSubstring) {
ReplaceAll(source, std::string(currentSubstring), std::string(newSubstring));
}

int InitAstFrameSet(AstFrameSet** astFrameSetPtr, const char* header, double restFreqGHz = 0)
{
std::cout << "Initializing AstFrameSet..." << std::endl;
Expand All @@ -23,7 +46,12 @@ int InitAstFrameSet(AstFrameSet** astFrameSetPtr, const char* header, double res
std::cout << "Missing header argument." << std::endl;
return -1;
}
astPutCards(fitschan, header);

// Replace all NCP projections with SIN as a workaround
std::string header_str = header;
ReplaceAll(header_str, "--NCP", "--SIN");
astPutCards(fitschan, header_str.c_str());

if (restFreqGHz != 0)
{
if (astTestFits(fitschan, "RESTFREQ", nullptr) != 0)
Expand Down

0 comments on commit 43e4a31

Please sign in to comment.